I'm using ActiveMQ 5.3.0 with a single broker running as a stand-alone app
(not
embedded).
I have a client consumer app with the following code which finds the broker
through multicast discovery, obtains a connection to it and a session on it:
ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("discovery:multicast://default?group=myMessageBroker");
ActiveMQConnection msgBrokerConnection =
(ActiveMQConnection)connectionFactory.createConnection();
Session msgBrokerSession = msgBrokerConnection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
When the broker is running, the above code successfully discovers the
broker,
gets a connection to it and a session on it.
However, when the broker is not running, the same code still returns an
ActiveMQConnectionFactory and a connection to a non-existent broker. The
subsequent attempt to create a session on this connection fails.
I would ideally like to have the ActiveMQConnectionFactory return null or
throw
an exception if no brokers are discovered.
Is there a way to determine when no brokers are discovered?
Any thoughts are appreciated.
--
View this message in context:
http://old.nabble.com/Broker-discovery-when-no-brokers-exist-still-returns-a-connection-factory-which-cannot-be-used.-tp27473153p27473153.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.