Messaging Domains

JMS API supports 2 types of messaging domains:
1. Point-to-Point (PTP)
2. Publish-Subscribe
Point-to-Point Messaging 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.
PTP messaging has the following characteristics:
• Each message has only one consumer.
• A sender and a receiver of a message have no timing dependencies. The receiver
can fetch the message whether or not it was running when the client
sent the message.
• The receiver acknowledges the successful processing of a message.
Publish/Subscribe Messaging Domain:
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.
Use PTP messaging when every message you send must be processed successfully by one consumer.
Pub/sub messaging has the following characteristics:
• Each message may have multiple consumers.
• Publishers and subscribers have a timing dependency. A client that subscribes to a topic can consume only messages published after the client has created a subscription, and the subscriber must continue to be active in order for it to consume messages.
The JMS API relaxes this timing dependency to some extent by allowing clients to create durable subscriptions. Durable subscriptions can receive messages sent while the subscribers are not active. Durable subscriptions provide the flexibility and reliability of queues but still allow clients to send messages to many recipients.
Use pub/sub messaging when each message can be processed by zero, one, or many consumers.
1. Point-to-Point (PTP)
2. Publish-Subscribe
Point-to-Point Messaging 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.
PTP messaging has the following characteristics:
• Each message has only one consumer.
• A sender and a receiver of a message have no timing dependencies. The receiver
can fetch the message whether or not it was running when the client
sent the message.
• The receiver acknowledges the successful processing of a message.
Publish/Subscribe Messaging Domain:
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.
Use PTP messaging when every message you send must be processed successfully by one consumer.
Pub/sub messaging has the following characteristics:
• Each message may have multiple consumers.
• Publishers and subscribers have a timing dependency. A client that subscribes to a topic can consume only messages published after the client has created a subscription, and the subscriber must continue to be active in order for it to consume messages.
The JMS API relaxes this timing dependency to some extent by allowing clients to create durable subscriptions. Durable subscriptions can receive messages sent while the subscribers are not active. Durable subscriptions provide the flexibility and reliability of queues but still allow clients to send messages to many recipients.
Use pub/sub messaging when each message can be processed by zero, one, or many consumers.