activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kjones <>
Subject Broker discovery when no brokers exist still returns a connection factory which cannot be used.
Date Fri, 05 Feb 2010 19:58:20 GMT

I'm using ActiveMQ 5.3.0 with a single broker running as a stand-alone app

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 

ActiveMQConnection msgBrokerConnection =

Session msgBrokerSession = msgBrokerConnection.createSession(false,

When the broker is running, the above code successfully discovers the
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
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:
Sent from the ActiveMQ - Dev mailing list archive at

View raw message