2

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!

xabhi
  • 798
  • 1
  • 13
  • 30

2 Answers2

2

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.

Petter Nordlander
  • 22,053
  • 5
  • 50
  • 84
0

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!

Vihar
  • 3,626
  • 2
  • 24
  • 47
  • think that if a producer and consumer are connecting broker using 2 different JVM [different context]. Then how can this possible? – Arun Prakash Feb 05 '15 at 10:56
  • if they are in different context then I don't think there will be a requirement of this communication altogether – Vihar Feb 05 '15 at 11:41