You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Noel Burton-Krahn <no...@burton-krahn.com> on 2009/04/01 21:12:51 UTC

activemq sends extra newline after null at end of Stomp frame

According to the stomp spec at http://stomp.codehaus.org/Protocol, frames
are terminated by a NULL character.  However, activemq sends an extra
newline after the NULL.  See
activemq-5.1.0-svn20081024/src/main/activemq/connector/stomp/StompCommandWriter.cpp
line 90.

This bit me while I was using Perl's Net::Stomp client against activemq.  It
would read a complete message up to the NULL, and leave the extra newline on
the socket.  Net::Stomp has a can_read() function which returns true if
there is anything available to read on the socket, naively assuming that if
there is one byte available to be read, there must be a while message behind
it.  But, since there's only activemq's extraneous newline, can_read() will
return true and the next call to Net::Stomp will hang unexpectedly waiting
for a whole message.

Net::Stomp's can_read function could be written to be more robust, but the
real probem is activemq is not behaving according to spec.

Other than that, activemq is working quite well for us.  Thanks!

~Noel