JMS侦听器-动态选择目的地 [英] JMS listener - dynamically choose destinations

查看:136
本文介绍了JMS侦听器-动态选择目的地的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在独立服务器上部署的ActiveMQ上有许多目的地(队列).我想从程序中动态侦听这些目的地.目前,我正在听这些目的地,如下所示:

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!

推荐答案

请参阅综合目标" 目标通配符,这两个功能将使您拥有一些联系满足您的要求.

Have a look at the documentation on Composite Destinations and Destination Wildcards, these two features would allow you to have something close to what you are asking for.

这篇关于JMS侦听器-动态选择目的地的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆