How does a JMS Topic Subscriber in a clustered app

2019-05-27 03:11发布

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?

2条回答
疯言疯语
2楼-- · 2019-05-27 03:32

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.

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-05-27 03:50

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

查看更多
登录 后发表回答