activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anhvu <>
Subject ActiveMQ and STOMP BytesMessage
Date Wed, 08 May 2013 05:27:16 GMT
I've used STOMP TextMessage with ActiveMQ for quite a time without any
problem (FLEX Client sending STOMP text msgs and java server side receive
them). Recently for some reason I switched to BytesMessage but having some

The java applications send and receive BytesMessage without any problem (on
openwire transport). However, for messages received on STOMP, there always
are extra 2 bytes at the beginning of the message and it looks like it's
value is the length of stomp message body. Looking through the stomp client
code and there is no operation to put body length into the body field so it
must be part of ActiveMQ handling stomp bytesmessage. 

Here is the code to take out msg:

byte[] buf = new byte[65536];
int len = ((BytesMessage) msg).readBytes(buf);

buf[0] and buf[1] are length of msg body. What I've sent started from

Is it a bug or it's designed? It's a problem because I receive messages from
many transports and couldn't know when to keep and when to discard those
first 2 bytes.

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message