I have many destinations (queues) on ActiveMQ deployed on a separate server. I want to dynamically listen to these destinations from my program. Currently I'm listening to these destinations as shown below:
<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="failover://(tcp://192.168.25.26:61616)" />
</bean>
<bean id="myMessageListener" class="MyMessageListener"></bean>
<jms:listener-container
container-type="default"
connection-factory="jmsConnectionFactory"
acknowledge="auto" >
<jms:listener destination="TEST.FOO" ref="myMessageListener" />
<jms:listener destination="foo.bas" ref="myMessageListener" />
<jms:listener destination="foo.bar" ref="myMessageListener" />
</jms:listener-container>
I'm able to successfully receive messages from these destinations. However, as you can see I've to add destinations manually in the above configuration. I want to skip this and prefer the listener to dynamically choose the destinations. Is this possible? How? Many thanks in advance for any sort of help/guidance!