Java Reference
In-Depth Information
can use either one or both of these models—it all depends on how messages will be ex-
changed. We'll discuss each of these messaging models here.
Point-to-point
In the PTP scheme, a single message travels from a single producer (point A) to a single
consumer (point B). There may be multiple producers and consumers, but only one con-
sumer will process a given message. PTP message destinations are called queues . Produ-
cers write to the queue and consumers read from the queue. PTP doesn't guarantee that
messages are delivered in any particular order—the term queue is more symbolic than any-
thing else. If more than one potential consumer exists for a message, a random consumer is
chosen, as shown in figure 4.4 .
Figure 4.4. PTP messaging model with one producer and two consumers
The classic message-in-a-bottle story is a good analogy for PTP messaging. The message
in a bottle is set afloat by a lonely castaway (the producer). The ocean (the queue) carries
the message to an anonymous beach dweller (the consumer). The message can be “found”
only once.
 
Search WWH ::




Custom Search