Introduction to Messaging

With the advent of distributed computing architecture in the computer world, dedicated servers performing distinct functions became inevitable. Along with this arose a need to communicate efficiently between these remote servers. To enable this, messaging concepts were introduced.

As you might expect, messaging is a mechanism by which two software components or applications communicate with each other. This is done by maintaining a communicating agent that carries messages in different formats.

This mechanism is analogous to a post office. The postal agent is the message carrier, and the letter being delivered is a message. The letter can be in the form of a parcel, a package, or even just an envelope. A receiver of mail is capable of sending mail too. You can send mail to a single person or to multiple people. You have the choice of getting confirmation when the mail you sent is received or just taking it for granted that the mail will reach its destination.

A software messaging system, like the postal agent, carries message objects. Message objects can be in many formats, as you will discover later. The message can be sent from point to point, or it can be sent by a single source (the publisher) to multiple subscribers. On receipt of the message by the receiver, a confirmation may or may not be sent back to the source from which the message emanated.

With the introduction of a messaging system to communicate between different software components, the next question that arises is, How is the difference in languages handled?

To counter this problem, message-oriented middleware (MOM) servers were introduced. These middleware servers take care of the translation of messages between communicating servers.

A message is a serializable object containing a header, properties, and a body. The header contains routing information, while the main message content is stored in the body of the message. Two types of message delivery are point-to-point and publisher-subscriber.

Point-to-Point Messaging

Point-to-point messaging is also known as peer-to-peer messaging, P2P messaging, and PTP messaging. The message-sending component sends a message to a receiving component. Now the message can be directly sent to the receiving component or put onto a message carrier called a queue; see Figure 15.1.

Figure 15.1. A point-to-point messaging system.

graphics/15fig01.gif

There can be only a single receiving component, although multiple senders can send messages through a single message queue.

Publisher-Subscriber Messaging

In publisher-subscriber messaging, a sender (called a publisher) sends messages under a message carrier called a topic. Components that wish to receive this message (called subscribers) subscribe to this topic and receive the message (see Figure 15.2). This kind of a messaging system is used when the same message is to be received by multiple applications. The publisher needs to send only a single copy of the message. The messaging system has the responsibility of making a copy for each subscriber.

Figure 15.2. A publisher-subscriber messaging system.

graphics/15fig02.gif

Here, there is no limit on the number of senders or the number of receivers.

The action of removing the message from the queue or topic is called message consumption. There are two types of message consumption:

  • Asynchronous The sender application sends a message in the queue or topic and does not wait for a reply but rather continues its other activities. The receiving application implements an event listener. When a message arrives in the queue, the messaging service provider delivers the message to the receiver by calling a listener method. Details about the method that the service provider calls to deliver the message are discussed later in today's lesson.

  • Synchronous The receiving application blocks and polls the queue until a message arrives in the queue. Once the receiving application finds a message, it receives the message and then continues its other activities.



Sams Teach Yourself BEA WebLogic Server 7. 0 in 21 Days
Sams Teach Yourself BEA WebLogic Server 7.0 in 21 Days
ISBN: 0672324334
EAN: 2147483647
Year: 2002
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net