The Point-to-point (PTP) messaging model ensures that a message is delivered only once to a single consumer. The following illustration shows three message producers sending messages to three different queues. Queues are defined with a maximum size and a threshold that indicates at what point to persist messages on the queue in the data store. If messages are taken off the queue at the same rate they are placed on the queue, then no messages are persisted.
In the diagram, Producer 2 sends a message to QueueB, which has three registered listeners. Because only one receiver will receive this message, the broker decides to let Consumer B1 receive the message. The other consumers do not receive that message.
Each message producer sends new messages to a queue, a destination on the broker. The broker, unless advised that there is a request for priority treatment, places new messages at the back of the queue. Consumer A takes the frontmost message off Queue A.
On Queue B, multiple consumers are listening to the queue, but only one consumer receives the message, Consumer B1. The QueueBrowser is browsing the queue without taking messages off the queue.
Queues are useful for load-balancing when many diverse systems share processing operations because additional receivers can be used to keep queue processing current. For example, applications for trading activities, credit card charges, online shopping carts, auctions, reservations, and ticketing often use queues.
Characteristics of the Point-to-point messaging model include:
The first message received by the broker is the first message delivered. This “First In, First Out” (FIFO) technique makes the second through nth messages endure until that first message is consumed. (Note that mixed priority settings on messages affect FIFO.)
Even when no clients specify an interest in receiving messages from a queue, messages wait for a consumer until the message expires.
When a message’s delivery mode is set to
PERSISTENT, the message is stored so that even a broker shutdown will not put the message at risk.There is only one message consumer for a given message. Many consumers can listen or receive on a queue, but only one takes delivery of a specific message.
When the message is acknowledged as delivered by the consumer, it is removed from the queue permanently. No one else sees it and no one else receives it.
The following illustration shows other features in Fuse Message Broker Point-to-point messaging.
The messages in this illustration are being received from the queue by three consumers:
Client Application 1,with a prefetch count of 2, took messages A and B off the queue. Message B is held in the prefetch buffer while message A is processed. When message B enters processing, the threshold trigger causes the consumer to draw off two more messages. The broker keeps track of unacknowledged messages and, if acknowledgement is not received before the session closes, the unacknowledged messages are reinstated in the queue.
Client Application 2, consuming with a message selector, reviews qualified messages on the queue to filter the messages that it wants to process. In this example, the consumer selected and acknowledged messages C and D. Assuming message F does not meet its criteria, this consumer perceives a momentarily empty queue.
Client Application 3, a synchronous consumer, receives a message, acknowledges its receipt, processes the message, and then waits to receive another message. The queue state indicates that message E was the frontmost message because messages A and B, while still in the queue, are awaiting acknowledgement from another consumer.
Client Application 4, a message producer, has sent message G to the queue and is in the process of sending message H.
The sample applications in the next chapter provide exercises that let you observe JMS messaging behaviors in both JMS messaging models.










