问题
I am going to be using Payara BTW....
Suppose I have:
A JMS Topic
An MDB configured as a durable topic subscriber
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