I am using ActiveMQ messaging broker and I have a requirement where the producer application would want to know if the consumer application consuming on the particular destination is up or not?
How can I achieve this?
Thanks!
I am using ActiveMQ messaging broker and I have a requirement where the producer application would want to know if the consumer application consuming on the particular destination is up or not?
How can I achieve this?
Thanks!
You should checkout Advisory messages. It's a topic you can subscribe to if you want updates on such events.
Specifically the topic: ActiveMQ.Advisory.NoConsumer.Queue
should be of interest. You need to enable it broker side though using the destination policy property: sendAdvisoryIfNoConsumers
.
You can do that by using java code as follows:
Destination class has a method getConsumers()
which will return List of Subscriptions to that destination,and it will in turn give you consumer information, by this you can check whether your required consumer is active or not.
Good luck!