JMS durable subscriber in a cluster with multiple instances

末鹿安然 提交于 2019-12-11 07:34:02

问题


I am going to be using Payara BTW....

Suppose I have:

  1. A JMS Topic

  2. An MDB configured as a durable topic subscriber

  3. Multiple instances of the MDB are deployed across the cluster and they are all using the same client ID value to make the durable subscription.

If this is the scenario, and given the way client ID values and durable subscriptions work, is it correct to say that only 1 of the MDB instances across the cluster will succeed in connecting and the others will fail?

Thanks!

Suppose you have a MDB deployed to a cluster, so there are multiple MDB instances across the cluster attempting to listen.


回答1:


As of the JMS 2.0 API [1], you can share the same durable subscription across nodes in an application cluster.

The following change has been made to aid scalability:

Applications are now permitted to create multiple consumers on the same durable or non-durable topic subscription. In previous versions of JMS only a single consumer was permitted.

You can use the JMS 2.0+ API to create a shared durable consumer using the JMSContext.createSharedDurableConsumer() methods [2]

[1] https://java.net/projects/jms-spec/pages/JMS20FinalRelease#What_s_new_in_JMS_2.0? (the ? is part of the link - go figure)

[2] https://docs.oracle.com/javaee/7/api/javax/jms/JMSContext.html#createSharedDurableConsumer-javax.jms.Topic-java.lang.String-



来源:https://stackoverflow.com/questions/38151575/jms-durable-subscriber-in-a-cluster-with-multiple-instances

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