It's not a secret anymore!*
The moose likes EJB and other Java EE Technologies and the fly likes why not durable subscriber on queue, and more? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "why not durable subscriber on queue, and more?" Watch "why not durable subscriber on queue, and more?" New topic
Author

why not durable subscriber on queue, and more?

Yan Zhou
Ranch Hand

Joined: Sep 02, 2003
Posts: 137
Hi there,

I'd like to know why durable subscription only applies to topic, not queue. The following is my reasoning,

there is only one consumer on the queue. If it is inactive, whether he gets msg. depends on whether the JMS provider uses a persistent store. If it does, the messages are always delivered when the listener reconnects later, otherwise it is lost. So the concept of durable subscriber does not make sense for queue.

But with topic, there is more than one subscriber. A subscriber may indicate that he does not care if the msg. is not delivered when the subscriber is inactive. Allowing nondurable subscribers allow a better performance as the messsages are not kept. But I wonder how much performance gain, though? After all, the message is already stored, and the only performance saving I can think of is to look it up in database, and some administrative type of work. It does need to remove the message, but that needs to be done anyway.

In addition, in a situation where several MDB subscribe to a topic, and both the beans and JMS provider run on the same app. server instance, I do not see why we would need durable subscriptions. Because the only reason for a consumer to become inactive is a server crash, in that case, client cannot even send messages to begin with. Did I miss anything here? (If MDB throws an exception, does that make it inactive? Or would the app. server remove the instance and create one immediately?)

Thanks,
Yan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why not durable subscriber on queue, and more?