256
sending messages. Such messages, which are delivered asynchronously, typically
consist of two parts: one part the message body contains the business data and
the other part the message header contains routing information. Since messages
are sent asynchronously, the sender does not have to wait for the message to be
delivered to the receiver.
There are two common messaging styles: point to point, and publish and sub
scribe. A point to point messaging style is used when messages are sent to only
one receiver. The recipient receives messages sent to it through a queue specifi
cally set up for the receiver. A message sender sends messages to this queue, and
the recipient retrieves (and removes) its messages from the queue. Publish and
subscribe, on the other hand, is intended to be used when there can be multiple
recipients of a message. Rather than a queue, this style uses a topic. Messages are
sent or, more correctly, published to the topic, and all receivers interested in
these messages subscribe to the topic. Any message published to a topic can be
received by any receiver that has subscribed to the topic. See Figure 6.2.
In addition, a typical MOM system has a message router that is responsible
for ensuring message delivery (according to the agreed upon quality of service) to
the receiver. The message router uses the message header information to deter
mine where and how to route the message contents.
message A
Topic
Client
m
Publish Subscribe
essag
Messaging System
e A
publish
message A
Client
Client
sen
m
d
essage B
message B
Client
Queue
Figure 6.2
Messaging System Queues and Topics
<
New Page 1
Clan Web Hosting