This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
In JavaEE5 tutorial, There is the statement about JMS durable subscription:
"At the cost of higher overhead, you can use the Session.createDurableSubscriber method to
create a durable subscriber. A durable subscription can have only one active subscriber at a
time. A durable subscriber registers a durable subscription by specifying a unique identity that is
retained by the JMS provider. Subsequent subscriber objects that have the same identity resume
the subscription in the state in which it was left by the preceding subscriber. If a durable
subscription has no active subscriber, the JMS provider retains the subscription’s messages until
they are received by the subscription or until they expire."
What I can't understnand is "A durable subscription can have only one active subscriber at a
time.", For example, If I have a Message drivern bean as a durable subscriber, there is only one bean instance at one time to process the message? if that case, how does it handle concurrent processing? What should be the true container behavior regarding this?
Also at the begining, I understand it as " one topic can have only one active durable subscriber at a time", I just do a test with 3 beans as durable sucscribers at the same topic, it works. So I think I was wrong on this. One Topic can have many durable subscribers. Otherwise durable subscribers don't make sense compare to the durable features provided by Queue.
Thanks you in advance if you could give me some ideas on the question I have. What I want to do is have many MDBs to listen on the Topic for different activities such as persistent, notification to differnt suppliers and retailers etc. So I need many durable subscribers on same topic and must handle the concurrent transactions.
Joined: Dec 02, 2009
Got it, from Webshpere 6.1 documentation, It said:
"In normal operation there can be at most one active (connected) subscriber for a durable subscription at a time. However, when running inside an application server it is possible to clone the application server for failover and load-balancing purposes. In this case, a cloned durable subscription can have multiple simultaneous consumers."
So it's possible to process concurrently in application server. However, not sure if each kind of app server have the same feature. At least it's not specified in JMS spec I think. If you can find the similar statement in JMS spec, please let me know.
One more question, Do we need a durable subscription if the sender, JMS provider and consumer in the same app server? After all, it has a overhead for this durable feature. how about clustered environment?