• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1471
  • Last Modified:

JMS Difference Between Queue and Durable Topic

I'm trying to figure out the difference between a Durable Topic and a Queue in JMS.

At the surface, queues and topics differ in that a queue has 1 consumer but topics can have 0,1 or n consumers.

I think that's where the differences end - but not really in this case because a durable topic can have only one active subscriber at a time ( http://download.oracle.com/javaee/5/tutorial/doc/bncfu.html ).

To my understanding, messages in a queue are persisted until they are consumed.  Same with a durable topic.  For both, a  Queue and Durable Topic the consuming process does not have to be running when messages are produced and the messages will be delivered when the consumer is brought up.

0
sevzas
Asked:
sevzas
1 Solution
 
Bart CremersJava ArchitectCommented:
A queue saves a message until one consumer arrives and then delivers the message to that single consumer. Even when more consumers exist, only one will get it.

A durable topic saves messages for all registered subscribers. This means that one a new consumer arrives, it will register itself using a unique name. The topic assures that every subscriber to the topic will receive every message that it gets, even if a subscriber is not online.
0
 
sevzasAuthor Commented:
Good answer! Thanks!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now