简体   繁体   English

如何配置Message Driven Bean Application和Glassfish来使用来自远程Message Broker的消息?

[英]How to configure Message Driven Bean Application & Glassfish to consume messages from remote Message Broker?

I've created a simple MDB application and deployed it to Glassfish v 3.1 with embedded MQ broker. 我创建了一个简单的MDB应用程序,并将其部署到带有嵌入式MQ代理的Glassfish v 3.1。 Destination Resource with name "jms/Queue" was created as well. 还创建了名为“jms / Queue”的目标资源。 Please see part of the code below: 请参阅以下部分代码:

    @MessageDriven(
       mappedName = "jms/Queue",
       activationConfig = {
          @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
        }
    )

    public class MessageBean implements MessageListener {

         public void onMessage(Message message) {
........

This works fine, but how to configure this application to work with remote MQ broker instance(located on another host)? 这工作正常,但如何配置此应用程序以使用远程MQ代理实例(位于另一台主机上)?

You have two options: 您有两种选择:

  • Use the REMOTE mode when configuring your JNDI resources for ConnectionFactory and Queue entities so these entities are hosted by a remote OpenMQ. ConnectionFactoryQueue实体配置JNDI资源时使用REMOTE模式 ,以便这些实体由远程OpenMQ托管。

  • Configure a bridge to connect together two queues hosted in difference instances. 配置网桥以将差异实例中托管的两个队列连接在一起。 Here is the documentation reference about that feature. 以下是有关该功能的文档参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM