Search code examples
activemq-classicspring-jms

How to get features of CompletionListener class in JMS using ActiveMQ "Classic"?


I'm using ActiveMQ "Classic" for my JMS application which is a simple chat application in which I would like to get notified when a message is sent successfully. If failed then the reason for failure. These features are implemented in javax.jms.CompletionListener, but the activemq-all-xxx.jar does not contain this class. What should I do?


Solution

  • javax.jms.CompletionListener is part of JMS 2.0 which ActiveMQ 5.x doesn't implement. If you really want this functionality then you should migrate to ActiveMQ Artemis (ActiveMQ's next-generation broker) which does implement JMS 2.0.

    To be clear javax.jms.CompletionListener is used to get notified about messages which are sent asynchronously. If sending message asynchronously isn't a requirement for your application you could simply send them synchronously and you would get notified of failures, etc. directly from the sending method call.