I copied the wrong code for the sender. Here's an update with some more
debugging.
The length of the message content before sending is 10366. When received,
all properties are okay; the message content key is present, but the content
is an empty string.
Sender:
try
{
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = null;
Topic topic = session.createTopic(getSubject());
producer = session.createProducer(topic);
producer.setDeliveryMode(DeliveryMode.PERSISTENT);
MapMessage mapMessage = session.createMapMessage();
if(properties!=null && !properties.isEmpty())
{
java.util.Iterator keyIter = properties.keySet().iterator();
while(keyIter.hasNext())
{
String key = keyIter.next();
mapMessage.setStringProperty(key, properties.get(key));
}
}
mapMessage.setString("MessageContent", xmlCommand);
logger.info("Message content length=" +
mapMessage.getString("MessageContent").length());
producer.send(mapMessage);
}
Receiver:
private void receiver_Listener(IMessage message)
{
IMapMessage mapMessage = message as IMapMessage;
if (mapMessage != null)
{
string content = mapMessage.Body.GetString("MessageContent");
Logger.Info("Body count=" + mapMessage.Body.Count);
Logger.Info("Prop count=" + mapMessage.Properties.Count);
foreach (string curkey in mapMessage.Body.Keys)
{
Logger.Info("Body Key=" + curkey + ", value=" +
mapMessage.Body[curkey]);
}
foreach (string curkey in mapMessage.Properties.Keys)
{
Logger.Info("Prop Key=" + curkey + ", value=" +
mapMessage.Properties[curkey]);
}
}
}
--
View this message in context:
http://www.nabble.com/ActiveMQ-message-content-is-truncated-tp25769997p25775002.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.