Hello,

Using the latest AMQ 5.0.0 release and the ruby stomp-1.0.5 gem, I'm
trying to send some messages via the example catstomp.rb script and
receive the messages using the example javascript from
http://activemq.apache.org/ajax.html. However, it doesn't appear that
the message body is making it to the messages received on the
javascript side.

I send some messages like this to send the time every 5 seconds to the topic:
while [ true ] ; do date ; sleep 5 ; done | ruby catstomp.rb

Here's my javascript... pretty much copy and paste from the example:

var myHandler = {
  rcvMessage: function(message) {
    alert("received "+message);
  }
};
amq.addListener('web','topic://stompcat',myHandler.rcvMessage);

Using firebug to examine the http response from amq, all I ever
receive is a message with an empty body:

<ajax-response>
<response id='web' destination='topic://stompcat' ></response>
</ajax-response>

When I run the stompcat.rb script, I receive the message body:

$ ruby stompcat.rb
Connecting to stomp://localhost:61613 as
Getting output from /topic/stompcat
Sun Jan  6 14:50:07 EST 2008
Sun Jan  6 14:50:12 EST 2008
Sun Jan  6 14:50:17 EST 2008
Sun Jan  6 14:50:22 EST 2008
Sun Jan  6 14:50:27 EST 2008

If I go to the topic in the activemq admin tool,
http://localhost:8161/admin/topics.jsp, and send a message to the
stompcat topic, I receive the message body in the javascript consumer
as well as the stompcat.rb script.

<ajax-response>
<response id='web' destination='topic://stompcat' >Enter some text
here for the message body...</response>
</ajax-response>

Is this supposed to work? It seems like there is something missing
when sending from stomp and trying to receive via javascript. Any help
would be most appreciated!

Regards,

Archie

Reply via email to