多个jms服务器的单个jms使用者 [英] single jms consumer for multiple jms servers

查看:121
本文介绍了多个jms服务器的单个jms使用者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用分布式jms队列,而weblogic是我的应用程序服务器.我的集群环境中部署了三台jms服务器.生产者仅使用队列jndi查找'udq'的名称发送消息.现在,我已经为每个jms服务器关联了一个使用者,并且我能够使用该消息,到目前为止没有问题.

I am using a distributed jms queue and weblogic is my app server. There are three jms servers deployed in my clustered enviroment. The producers just send the message using name of queue jndi lookup 'udq' for example. Now I have associated a consumer for each jms server and I was able to consume the message, no problem so far.

这里是个问题,我可以让一个使用者使用来自3个jms服务器的消息. Weblogic允许使用以下语法@

Here is question, can I have a single consumer to consume the messages from the 3 jms servers. The weblogic allows jndi naming for destination lookup with following syntax @

            qsession1 = qcon1.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
            qsession2 = qcon2.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
            qsession3 = qcon3.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

            queue1 = (Queue)ctx.lookup("JMSServer-1@UDQ");
            queue2 = (Queue)ctx.lookup("JMSServer-2@UDQ");
            queue3 = (Queue)ctx.lookup("JMSServer-3@UDQ");
            qreceiver1 = qsession1.createReceiver(queue1);
            qreceiver2 = qsession2.createReceiver(queue2);
            qreceiver3 = qsession3.createReceiver(queue3);
            qreceiver1.setMessageListener(this);
            qreceiver2.setMessageListener(this);
            qreceiver3.setMessageListener(this);

            qcon1.start();
            qcon2.start();
            qcon3.start();

我仅为上述使用者实现了一个OnMessage.这是行不通的.任何建议请..

I have only one OnMessage implemented for the above consumer. This does not work. Any suggestions please..

推荐答案

不,您不能让使用者从多个JMS服务器接收消息.使用者只能从一个JMS服务器接收消息.您需要创建多个使用者以从多个JMS服务器接收消息.

No, you can't have a consumer receiving messages from more than one JMS server. A consumer can receive messages from only one JMS server. You need to create multiple consumers to receive messages from multiple JMS servers.

这篇关于多个jms服务器的单个jms使用者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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