How does a JMS Topic Subscriber in a clustered application server recieve messages?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-22 22:49:43

问题


Suppose I created a JMS Topic (PropertiesTopic) with one subscriber (PropertiesSubscriber). PropertiesSubscriber is running in a load balanced application server cluster as shown in the picture below.

alt text http://www.freeimagehosting.net/uploads/be28c03781.png

When a message is delivered to PropertiesTopic, do all the instances of PropertiesSubscriber running on different app servers get that message or does the message get delivered to only one PropertiesSubscriber instance running on an app server determined by the load balancer?


回答1:


JMS 2.0 introduces shared subscriptions. These allow multiple consumers (ex: on different nodes of a cluster) to share a single Topic subscription. Only one of the consumers sharing a subscription will get each message.

To designate multiple consumers as sharing a subscription, they need to use the same sharedSubscriptionName




回答2:


All the instances of PropertiesSubscriber running on different app servers WILL get that message. Even if there are multiple listeners on the same app server for the topic, all the listeners will get the message.



来源:https://stackoverflow.com/questions/2017520/how-does-a-jms-topic-subscriber-in-a-clustered-application-server-recieve-messag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!