When I receive a ActiveMQBytesMessage
, the Content
property has exactly the expected length, but all bytes are zero, it looks like an uninitialized buffer with just the correct length.
I also tried ReadBytes(buffer, length)
on the message object, and got the same empty buffer.
I'm pretty sure that the messages arrives correctly at the broker, because I can look into the XML representation of the message via the ActiveMQ web interface, and there I can see the correct Base64 representation in <content><data>
I'm using the latest version 1.5.6.
Any ideas what I might be doing wrong?
Update
How I create the message before sending it using a publisher:
var binMessage = new ActiveMQBytesMessage();
binMessage.Content = /* ... */
This is what a message looks like on the web interface (queue browser):
<org.apache.activemq.command.ActiveMQBytesMessage>
<commandId>5</commandId>
<!-- ... -->
<content>
<data>H4sIAN[...]AA=</data>
<offset>0</offset>
<length>305</length>
</content>
<!-- ... -->
</org.apache.activemq.command.ActiveMQBytesMessage>
This is what I basically do in my MessageListener
:
Console.WriteLine("Message ID: " + message.NMSMessageId);
var bytesMessage = message as IBytesMessage;
if (bytesMessage != null)
{
Console.WriteLine("Content length: " + bytesMessage.Content.Length);
Console.WriteLine("Content: " + BitConverter.ToString(bytesMessage.Content));
}
This gives me the correct content length, but the actual content is just empty (hex output is just 00-00-00 etc.).