Chapter 4. Point-to-Point Messaging
This chapter focuses on the point-to-point (p2p) messaging model. The point-to-point model is used when you need to send a message to only one message consumer. Even though multiple consumers may be listening on the queue for the same message, only one of those consumer threads will receive the message. This is different from the publish-and-subscribe model described in Chapter 5, where a message is broadcast to (and consumed by) multiple consumers.
In this chapter, we will describe the point-to-point model through
the use of a typical messaging scenario involving a borrower and a
mortgage lender. In our example, the QBorrower class will submit a loan application
via JMS messaging to a QLender class.
The QLender class will receive the loan
request through a message queue, determine whether to accept or decline
the loan based on certain business rules, and send the result (accept or
decline) back to the QBorrower class
through another message queue. However, before launching into the
messaging example, we will first describe the main characteristics and use
cases of the p2p messaging model.
Point-to-Point Overview
In the p2p model, the producer is called a sender and the consumer is called a receiver. The most important characteristics of the point-to-point model are as follows:
Messages are exchanged through a virtual channel called a queue. A queue is a destination to which producers send messages and a source from which receivers consume messages. ...