On 10/20/06, sileshi <[EMAIL PROTECTED]> wrote:


I have achieved Perl Stomp and Java JMS clients exchanging Text Messages
via
ActiveMQ. That is wonderful!



great!


Where I have run into a problem is in the reas of sending message that
involves
JMS BytesMessage from Java JMS client to destination a Perl Stomp client
consumes. I have discovered the AMQ Stomp server doesn't seem to write to
the
socket in this case.


He had a little bug in our code that was recently fixed.  If you build
activemq 4.0.x-SNAPSHOT or 4.1-SNAPSHOT from source it should be able to
send message to the stomp client.

I have debugged this through the Net::Stomp receive_frame() method where the
socket is ready for read, but we read zero bytes everytime. Note that,
this
happens
only with JMS BytesMessage. JMS Text Message can be exchanged between perl
and
java clients with no problem.



yep.


I have eliminated the fact this is not socket problem with binary data, by
sending
binary data between Perl clients. Note that Stomp being text protocl, thus
does not
take into consideration that fact that the content or body of message
could
be
non-text data. Therefore, if you send perl-to-perl binary data(in body
only), the socket
read stops too soon, due to Net::Stomp receive_frame() thinks it is end of
frame
when runs into null byte.



yep.  For stomp to send binary data that has embeded nulls, you have to set
a
content-length header.

This indicates to me, that the following changes may be required:

1. Stomp Protocl
    a. Add either new header or extended header for message body encoding
        content-encoding: base64, text, etc...
        content-length: length of message body in bytes


yep. we chose content-length

2. ActiveMQ support
    ActiveMQ Broker need to add conetnt encoding and length when passing
    message to Stomp Server. This is true when Stomp Server passes it to
    broker



Yep.. when ActiveMQ sees STOMP message with content-length it assumes it's a
BytesMessage and when it gets a BytesMessage it sets the content-length
header on the stomp frame.

3. Stomp protocol implementation
     Need to change the way incoming socket data is read
     based on content-length and content-encoding.


Some stomp clients allready support this.  I have recently submitted a patch
for perl Net::Stomp client so that it supports this too.  If you want to
apply the patch yourself, please see:

http://issues.apache.org/activemq/browse/AMQ-978


You may ask, why do I need to send binary message body?
I'm trying to build RPC over the JMS Message Broker using a binary
protocol on top of Stomp. Thus, RPC call has to be
marshalled, let's say using BER, and will be envolped in Stomp and
sent via Mesage Broker to a Java server.


sounds great!


Any thought will be welcomed...


We were thinking along the same lines.. It's just a matter of waiting for
all the fixes to get release.


-Sileshi
--
View this message in context:
http://www.nabble.com/AMQ-Missing-JMS-Bytes-Message-on-stomp-tf2483639.html#a6925742
Sent from the ActiveMQ - User mailing list archive at Nabble.com.




--
Regards,
Hiram

Blog: http://hiramchirino.com

Reply via email to