I am writing a JMS client that consumes from a queue. My broker is activemq, if that matters.
One of the requirements is that the client must get started, even if the broker is not working. In this case, he should behave as if there are no messages in the queue, and as soon as the broker gets up and the messages begin to arrive accordingly.
The problem is that in my code:
connectionFactory = new ActiveMQConnectionFactory(url);
Connection connection = connectionFactory.createConnection();
connection.start()
If the broker is off, it gets stuck in connection.start(). Although I would like to connection.start()return silently and continue to try to connect in the background and consume messages while he can, and be silent when he cannot.
How can i achieve this.
source
share