With a single connection factory you can only use the failover transport (
http://activemq.apache.org/failover-transport-reference.html ) to connect to
multiple brokers, but only one broker URL will be used at a time.
If you want to have two active connections (or connection pools) to two
different brokers simultaneously you need to have multiple connection
factories.
On Sep 14, 2011, at 7:35 PM, jessezbj wrote:
> How to create connections to different brokers by using one
> ConnectionFactory?
>
> Can the code be written as
>
> ActiveMQConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory();
>
> for each url in URLs {
> connectionFactory.setBrokerURL(url);
> Connection connection = connectionFactory.createConnection();
> connection.start();
> }
>
> And is there any other better way to manage multiple connections (to
> different brokers) in one client (which can save resources on the client,
> save the scheduling overhead, and so on.
>
> Thanks...
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/How-to-create-connections-to-different-brokers-by-using-one-ConnectionFactory-tp3814559p3814559.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.