Message Queues

The messaging server administrator explicitly creates queues so that messages are sequentially cached for their receivers. As was mentioned earlier, the producer in the PTP model is called the sender and the consumer in the PTP model is called the receiver. The sender sends messages to a queue and declares the Quality of Service (QoS) – the delivery mode, time-to-live, and priority – as well as whether any reply is requested from the receiver.

The sender sets headers, properties, and body content for each message before sending it off to the queue on the messaging server. The messaging server (or broker, or provider), records the message in its log, acknowledges receipt of the message to the sender, and immediately distributes the message to the appropriate listening receiver. While only one receiver can consume the latest message, several receivers may be reading the queue, taking turns to consume messages. If the delivery mode of the message is PERSISTENT, any undelivered messages are placed in the messaging server's persistent message store database.

The figure below shows a typical PTP connection topology with several message producers sending messages to queues and message consumers receiving these messages by connecting to the appropriate queues:

click to expand

Some of the important characteristics of the PTP messaging domain are as follows:

  • A queue adheres to the First-In, First-Out (FIFO) technique for message delivery. The first message received is the first message delivered. If there are no receivers listening to the queue, the messages are persisted. Durability and persistence are essential to the successful operation of this type of messaging domain.

  • Even when there are multiple receivers listening for messages from a single queue, there is absolutely one and only one receiver for any given message. Even while many prospective receivers balance the load by listening for messages on the same queue, only one of them takes delivery of a message.

  • As soon as a message is acknowledged as delivered by the receiver, it is immediately removed from the queue permanently. After this, no one else can either see it or get it.

However, authorized users of the queue browser – a mechanism that allows examination of queues without removing messages from them – can scan messages without destroying them by taking advantage of the durability that these sequential queues offer. While many prospective receivers could be listening to, or even browsing the queue, when a receiver elects to accept a queued message, the message is considered delivered. No other receiver will thereafter be able to access that message. Thus, PTP messaging is a one-to-one form of communication.



Professional JMS
Professional JMS
ISBN: 1861004931
EAN: 2147483647
Year: 2000
Pages: 154

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net