MDB 监听不同数量的 IBM MQ
我的目标是:
我有一个消息驱动 Bean(类),我想将其部署到 JBoss EAP 6 服务器。 MDB 应该侦听一个或多个外部队列,我将使用相应的 JMS 资源适配器连接到这些队列。我们需要使用 JMS,因为我们需要在队列和数据库连接之间拥有甜蜜的共享事务。
挑战在于,我们稍后需要将 MDB 与更多队列挂钩,并且我们需要能够做到这一点,而无需创建新的部署。因此我们只能更改配置并重新启动服务器。
这怎么可能做到呢?
Here is my goal:
I have a Message-Driven Bean (class), which I want to deploy to a JBoss EAP 6 server. The MDB should listen to one or more external queues which I'll connect to using the corresponding JMS resource adaptor. We need to use JMS because we need to have that sweet shared transaction between the queue and the database connections.
The challenge is that we will need to hook the MDB with more queues later on, and we need to be able to do that, without creating a new deployment. So we're limited to changing configurations and restarting the server.
How could this be done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不相信有任何方法可以做你想做的事,至少不能直接做。在您的例子中,MDB 绑定到单个 JMS 目标。您需要为您想要从中接收消息的每个 JMS 目标部署一个新的/不同的 MDB。
我建议部署 MDB 并让它侦听“主”队列,然后您可以将来自您关心的所有其他目的地的所有消息汇集到这个主队列中。 IBM MQ 可能具有本地执行此操作的功能,或者您也可以使用 Apache Camel 之类的功能。
I don't believe there is any way to do what you want, at least not directly. In your case, an MDB is tied to a single JMS destination. You would need to deploy a new/different MDB for every JMS destination from which you wanted to receive messages.
I recommend deploying your MDB and having it listen to a "master" queue and then you can funnel all the messages from all the other destinations you care about into this one master queue. IBM MQ may have functionality to do this natively or you could potentially use something like Apache Camel.