C.1 Message Distribution Patterns
Malformed Message Channel | |
Goal
Provide
a procedure to handle messages that can be successfully delivered but
cannot be properly processed due to invalid or corrupted message
data.
Participants
- Message client
-
Monitors a message delivery channel, receives messages, and processes
correctly-formatted messages according to a set of business rules.
- Malformed message channel
-
A messaging destination used for messages that cannot be processed.
- Message server
-
Responsible for routing messages to a delivery channel and receiving
messages from a client.
Interactions
The messaging server delivers messages to a client. If the client
cannot properly process the message, it routes a copy to a special
messaging destination configured within the messaging server. A human
can monitor this malformed message channel and
delete or act upon the messages it contains.
Notes
In JMS, use a specially designated Queue or a
Topic in your messaging server as a malformed
message channel. You use your message server's tools
to periodically examine the channel to identify unprocessed messages.
The incidence of malformed messages will probably be higher when
using SMTP for messaging.
Point-to-Point Distribution Pattern | |
Goal
Send a message once and only once to a destination known to the
sender.
Participants
- Sender
-
Originates a message and is aware of the destination.
- Recipient
-
Receives a message.
- Messaging server
-
Relays a message from a sender to a recipient.
Interactions
The sender dispatches a message to a messaging server, which is
responsible for relaying the message to a particular recipient. The
messaging server may proactively deliver the message (by contacting
the recipient directly), or hold the message until the recipient
connects to retrieve it.
Notes
In a JMS environment using an enterprise message queue product,
point-to-point messaging is implemented via the
Queue interface. In an SMTP environment with
JavaMail, all messaging is point-to-point.
Publish-Subscribe Pattern | |
Goal
Send a single copy of a message for delivery to multiple recipients
who may or may not be individually known to the sender.
Participants
- Sender
-
Originates a message of a particular type.
- Messaging server
-
Accepts a message from a sender and delivers it to zero or more
recipients.
- Recipients
-
Register to receive (subscribe to) a particular type of message.
Interactions
Rather than identify a particular recipient, the sender identifies a
message as being of a certain type. Recipients may then register with
the messaging server as being interested in receiving all messages of
a particular type. When a sender creates a new message, all
recipients who have expressed interest in receiving messages of that
type will receive a copy.
Notes
In a JMS environment, publish-subscribe is implemented via the
Topic interface. In an SMTP/JavaMail environment,
implementing publish-subscribe requires additional infrastructure,
either within your application or within your mail server.
|