activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alikic <>
Subject Problem using Ajax to listen to a queue/topic
Date Wed, 29 Dec 2010 16:02:31 GMT

First, my javascript code:

var queue = 'queue://qTest';
amq.init({ uri: 'http://localhost:8161/amq/amq', logging: true, timeout: 45,
clientId:(new Date()).getTime().toString() });
amq.addListener('testMq', queue, handler);

After this, I have no issues with sending messages to any queue or topic
using Ajax, so the amq object and AjaxServlet seem to be working correctly
in that regard. However, I have problems subscribing/receiving Ajax

This is what I see in the web console:
1) If I add a listener to an existing topic, the number of consumers on the
topic goes to 1.
2) If I add a listener to a non-existing queue, a new queue gets created and
the number of consumers on the new queue goes to 1.
3) If I add a listener to an existing queue, the number of consumers on the
queue stays at 0 (addListener fails)

Now, for the cases 1 and 2 (when addListener succeeds), as soon I start
sending messages to the destination (either using Ajax from the same
javascript code or from another application), the number of consumers on the
destination drops to 0, and no message gets delivered.

These are the only lines that I see on system.out after startup (logging
level is DEBUG):

WARN | Broker localhost not started so using broker instead
INFO | Connector vm://localhost Started

Any suggestions?

P.S. My javascript code and my AjaxServlet are in two *separate* web
applications on the same domain (same embedded jetty, started together with
activemq) - this is why I have uri: 'http://localhost:8161/amq/amq'. Does
this make any difference? If there was any issue with this setup I would
expect that Ajax doesn't work at all, but it is working partially - I can
send messages and I can subscribe, at least temporarily, on some
View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message