You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Allan Araya <aa...@canam-technology.com> on 2014/04/07 16:40:25 UTC

Connect to multiple brokers, one at a time

Hello,

I'm developing a java application which is intended to connect to 
several activeMQ brokers, but just one at a time.
The idea is to show a list of the possible brokers available and let the 
user choose one to connect.
The list of brokers will be predefined, so no discovery is needed. Also 
i'm working with spring beans, my beans definition looks like this:

<bean id="jmsContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
         <property name="connectionFactory" ref="connectionFactory" />
         <property name="destination" ref="destination" />
         <property name="messageListener" ref="messageListener" />
         <property name="autoStartup" value="true" />
     </bean>

     <bean id="connectionFactory" 
class="org.apache.activemq.pool.PooledConnectionFactory"
         destroy-method="stop">
         <property name="connectionFactory">
             <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                 <property name="brokerURL"
                     value="failover:tcp://192.168.1.15:61616" />
                 <property name="transportListener" 
ref="transportListener" />
             </bean>
         </property>
     </bean>

     <bean id="destination" 
class="org.apache.activemq.command.ActiveMQTopic">
         <constructor-arg index="0" value="var3Topic" />
     </bean>


I've been trying several configurations, all I have achieved is to 
connect to just one of the brokers (always the same one no matter what 
broker I choose),
  or to connect to all of them at the same time.

Any help will be appreciated,


Thanks, Allan.