tags:

views:

284

answers:

1
+4  Q: 

ActiveMQ JMS ping

Apache Activemq 5.2.0

My application listens to messages on three topics and sends messages on 2 topics. When my application is "webping"ed, I want to check if these topics are alive. I would like to know if this is possible. Here are my observations,

  1. Advisory messages can be used for this, but they send messages only when a producer/consumer joins. This is not quite what I want. I just want to check if I can send messages to outbound topics and can receive messages on the inbound topic.
  2. Custom Heartbeat solution. I can make every producer send a heartbeat message say every 5 seconds and the listener to not process heartbeat messages but update a flag/timestamp. That way I know the topic is up and running.
  3. Is there a heartbeat kinda thingi inbuilt in the Apache ActiveMQ? or a "ping for a topic" ?

I understand JMS is not for monitoring but if I am a producer for a topic, it will be good to know if I can produce on the topic with reasonable comfort level. I also agree between a ping and a message the channel can go down and that is an acceptable failure for me.

I just want a health check system/page which can say "yes topics are there and the activemq is running"

+3  A: 

You can monitor ActiveMQ using JMX. This will allow you to see if the server is up, what topics/queues are active and a lot of other useful information.

Kevin
Thanks Kevin. JMX is similar to the advisor-messages, in that I can get things like "EnqueueCount" etc which is useful.However, there is no way to check, that the topic is currently usable. If I don't find any way of doing it (other than sending a dummy message across) then I will accept this answer.
Calm Storm
What do you mean "usable"? If it exists, you can publish to it.
Kevin
Ignore the above comment. Apparently the JMX beans tell me exactly what I am after. So I wrote a simple utility which connects to an MBeanServer on the activemq JVM, and check if an MBean exists for my topic and that solves my problem. Nice !
Calm Storm