in src/main/csharp/Protocol/StompWireFormat.cs [370:453]
protected virtual void WriteMessage(Message command, BinaryWriter dataOut)
{
StompFrame frame = new StompFrame("SEND", encodeHeaders);
if(command.ResponseRequired)
{
frame.SetProperty("receipt", command.CommandId);
}
frame.SetProperty("destination", Destination.ConvertToStompString(command.Destination));
if(command.ReplyTo != null)
{
frame.SetProperty("reply-to", Destination.ConvertToStompString(command.ReplyTo));
}
if(command.CorrelationId != null )
{
frame.SetProperty("correlation-id", command.CorrelationId);
}
if(command.Expiration != 0)
{
frame.SetProperty("expires", command.Expiration);
}
if(command.Timestamp != 0)
{
frame.SetProperty("timestamp", command.Timestamp);
}
if(command.Priority != 4)
{
frame.SetProperty("priority", command.Priority);
}
if(command.Type != null)
{
frame.SetProperty("type", command.Type);
}
if(command.TransactionId!=null)
{
frame.SetProperty("transaction", command.TransactionId.ToString());
}
frame.SetProperty("persistent", command.Persistent.ToString().ToLower());
frame.SetProperty("NMSXDeliveryMode", command.Persistent.ToString().ToLower());
if(command.NMSXGroupID != null)
{
frame.SetProperty("JMSXGroupID", command.NMSXGroupID);
frame.SetProperty("NMSXGroupID", command.NMSXGroupID);
frame.SetProperty("JMSXGroupSeq", command.NMSXGroupSeq);
frame.SetProperty("NMSXGroupSeq", command.NMSXGroupSeq);
}
// Perform any Content Marshaling.
command.BeforeMarshall(this);
// Store the Marshaled Content.
frame.Content = command.Content;
if(command is BytesMessage)
{
if(command.Content != null && command.Content.Length > 0)
{
frame.SetProperty("content-length", command.Content.Length);
}
frame.SetProperty("transformation", "jms-byte");
}
else if(command is MapMessage)
{
frame.SetProperty("transformation", this.mapMarshaler.Name);
}
// Marshal all properties to the Frame.
IPrimitiveMap map = command.Properties;
foreach(string key in map.Keys)
{
frame.SetProperty(key, map[key]);
}
if(Tracer.IsDebugEnabled)
{
Tracer.Debug("StompWireFormat - Writing " + frame.ToString());
}
frame.ToStream(dataOut);
}