1
votes

I'm using JMS to talk to ActiveMQ. I had to disable failover for ActiveMQ, because I need to handle it myself.

So instead of using : failover//tcp//localhost:61616 I used : tcp//localhost:61616.

if I close ActiveMQ server and try to send a message, I'll received an exception. javax.jms.IllegalStateException: The Session is closed

but How can I be notified when the connection with the server is lost asap ?

The reason, I'm not using the ActiveMQ's failover it's because in production it should be MQSeries.

thanks

1

1 Answers

2
votes

I am not sure but TransportListener can help you.

Here is a sample of using it,

connection = new ActiveMQConnectionFactory(brokerUrl).createConnection();
ActiveMQConnection cc = (ActiveMQConnection)connection;
cc.addTransportListener(new YourTransportListener());  

Hope this may help you.