如何配置消息驱动Bean应用程序Glassfish消费来自远程Message Broker的消息? [英] How to configure Message Driven Bean Application & Glassfish to consume messages from remote Message Broker?

查看:124
本文介绍了如何配置消息驱动Bean应用程序Glassfish消费来自远程Message Broker的消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个简单的MDB应用程序,并将其部署到具有嵌入式MQ代理的Glassfish v 3.1中。也创建了名为jms / Queue的目标资源。
请参阅以下代码:

I've created a simple MDB application and deployed it to Glassfish v 3.1 with embedded MQ broker. Destination Resource with name "jms/Queue" was created as well. 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) {
........

这样做很好,但是如何配置这个应用程序来处理远程MQ代理实例(位于另一个主机上)?

This works fine, but how to configure this application to work with remote MQ broker instance(located on another host)?

推荐答案

您有两个选项:


  • 使用REMOTE模式配置JNDI资源 ConnectionFactory 队列实体,这些实体由远程OpenMQ托管。

  • Use the REMOTE mode when configuring your JNDI resources for ConnectionFactory and Queue entities so these entities are hosted by a remote OpenMQ.

Confi将一个桥连接在不同实例中托管的两个队列。以下是有关该功能的文档参考

Configure a bridge to connect together two queues hosted in difference instances. Here is the documentation reference about that feature.

这篇关于如何配置消息驱动Bean应用程序Glassfish消费来自远程Message Broker的消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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