JMS Message Models
JMS is based on
creation and delivery of messages. Messages are structured data that one
application sends to another. The creator of the message is known as the producer
and the receiver of the message is known as the consumer. The TIBCO EMS
server acts as an intermediary for the message and manages its delivery to the
correct destination.
JMS supports these
messaging models:
•
Point-to-Point (queues)
•
Publish and subscribe (topics)
•
Multicast (topics)
Point-to-Point
Point-to-point
messaging has one producer and one consumer per message. This style of
messaging uses a queue to store messages until they are received. The message
producer sends the message to the queue; the message consumer retrieves
messages from the queue and sends acknowledgement that the message was
received.
More than one producer
can send messages to the same queue, and more than one consumer can retrieve
messages from the same queue. The queue can be configured to be exclusive,
if desired. If the queue is exclusive, then all queue messages can only be
retrieved by the first consumer specified for the queue. Exclusive queues are
useful when you want only one application to receive messages for a specific
queue. If the queue is not exclusive, any number of receivers can retrieve
messages from the queue. Non-exclusive queues are useful for balancing the load
of incoming messages across multiple receivers. Regardless of whether the queue
is exclusive or not, only one consumer can ever consume each message that is
placed on the queue.
Publish and Subscribe
In a publish and
subscribe message system, producers sends messages to a topic. In this
model, the producer is known as a publisher and the consumer is known as
a subscriber. Many publishers can publish to the same topic, and a message
from a single publisher can be received by many subscribers. Subscribers
subscribe to topics, and all messages published to the topic are received by
all subscribers to the topic.
This type of message
protocol is also known as broadcast messaging because messages are sent
over the network and received by all interested subscribers, similar to how
radio or television signals are broadcast and received.
Durable Subscribers for
Topics
By default, subscribers
only receive messages when they are active. If messages arrive on the topic
when the subscriber is not available, the subscriber does not receive those
messages.
The EMS APIs allow you
to create durable subscribers to ensure that messages are received, even if the
message consumer is not currently running. Messages for durable subscriptions
are stored on the server as long as durable subscribers exist for the topic, or
until the message expiration time for the message has been reached, or until
the storage limit has been reached for the topic. Durable subscribers can
receive messages from a durable subscription even if the subscriber was not
available when the message was originally delivered.
When an application
restarts and recreates a durable subscriber with the same ID, all messages
stored on the server for that topic are delivered to the durable subscriber.
No comments:
Post a Comment