STOMP: Way to check if a consumer is running before sending a message?
Question
I'm wondering if there is a way to check if a consumer is running before sending a message? I'm using the latest php STOMP and am struggling to see if there's a way to detect if it's running before sending and having messages just build up in queue.
Thanks, Steve
Solution
Have a look at the BrokerStatisticsPlugin that's available in AMQ, it allows your client to send a message and have the broker send you all sorts of nice information about its current state.
See: http://activemq.apache.org/statisticsplugin.html
Regards
Tim www.fusesource.com
OTHER TIPS
If you have the ActiveMQ Web Console running, you can make a CURL call to the xml/queues.jsp page, which will return you XML with <queue>
nodes looking looking like
<queue name="integration">
<stats size="0" consumerCount="1" enqueueCount="92491" dequeueCount="92491"/>
<feed>
<atom>queueBrowse/integration?view=rss&feedType=atom_1.0</atom>
<rss>queueBrowse/integration?view=rss&feedType=rss_2.0</rss>
</feed>
</queue>
You're looking for the consumerCount
attribute of the <stats>
node.