Jul 22, 2008

JMS Queue vs Topic

JMS Queue

> A staging area that contains messages that have been sent and are waiting to be read. As the name queue suggests, the messages are delivered in the order sent. A message is removed from the queue once it has been read.

> point-to-point

> Only one consumer will get the message

> The producer does not have to be running at the time the consumer consumes the message, nor does the consumer need to be running at the time the message is sent

> Every message successfully processed is acknowledged by the consumer

JMS Topic

> A distribution mechanism for publishing messages that are delivered to multiple subscribers

> Multiple consumers can get the message

> There is a timing dependency between publishers and subscribers. The publisher has to create a subscription in order for clients to be able to subscribe. The subscriber has to remain continuously active to receive messages, unless it has established a durable subscription. In that case, messages published while the subscriber is not connected will be redistributed whenever it reconnects.