Difference Between Queues and Topics-JMS

Queues

JMS queues is a staging area that contains messages that have been sent and are waiting to be read. Queue represent PTP domain. A point-to-point (PTP) product or application is built around the concept of message queues, senders, and receivers. Each message is addressed to a specific queue, and receiving clients extract messages from the queue(s) established to hold their messages. Queues retain all messages sent to them until the messages are consumed or until the messages expire.There can be more but the message will be received to one of them. It also guarantees delivery of the message, means message will be there in the queue unless it is consumed by someone.

TOPICS

Topic represent Publish/Subscibe domain. A distribution mechanism for publishing messages that are delivered to multiple subscriber. In a publish/subscribe (pub/sub) product or application, clients address messages to a topic. Publishers and subscribers are generally anonymous and may dynamically publish or subscribe to the content hierarchy. The system takes care of distributing the messages arriving from a topic’s multiple publishers to its multiple subscribers. Topics retain messages only as long as it takes to distribute them to current subscribers.

Publish/Subscribe Model

The publish/subscribe model supports publishing messages to a particular message topic. Subscribers may register interest in receiving messages on a particular message topic. In this model, neither the publisher nor the subscriber knows about each other. A good analogy for this is an anonymous bulletin board.

The following are characteristics of this model:

  1. Zero or more consumers will receive the message.
  2. There is a timing dependency between publishers and subscribers. The publisher has to create a message topic for clients 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
Advertisement

About rajnautiyal
Experience in Design and Development of web projects in struts,hibernate,springs,ajax,Flex . Development .Experienced in the implementation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 70 other followers