Message Distribution Patterns
Message distribution is built around
the concept of a message
channel
, which happens to be the fundamental
idiom behind the JMS API. A message channel provides a named
destination for messages. Senders can access the channel to send
messages, and receivers can read messages off the channel.
It’s that simple. In the email world, a message
channel consists of the combination of SMTP (for sending and
transport) and a mailbox (for receipt). In JMS, a channel is
represented as either a Queue
or a
Topic
object, for point-to-point or
publish-subscribe messaging, respectively. In a MOM environment,
channels can be created and destroyed on the fly, or you can
preconfigure them within the MOM system.
Point-to-Point Distribution Pattern
The simplest form of messaging is from one actor to one other actor. This situation applies when using messaging to perform remote procedure calls or to deliver document messages for processing by a particular server. In these cases, it is important that a request be sent once and only once, and that the message be received and processed once and only once. The Point-to-Point Distribution pattern defines this behavior for our applications.
In the ubiquitous purchasing system example, a purchase order should only be sent once, and should only be fulfilled once. This requirement is particularly important when messaging is used to tie together parts of a process: a message sent by an order handler requesting credit card processing ...
Get J2EE Design Patterns now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.