Message Queuing vs. E-Mail

Doesn't this sound a lot like e-mail? Both e-mail and message queue systems have messages, with senders and receivers. An e-mail system has mailboxes and a message queue system has queues, but they generally are similar. And the queue manager is a lot like an e-mail server in that it will forward messages to their proper destinations. So what is the difference?

You can think of e-mail as person to person communications. The information that is sent has to be readable and interpreted by humans. Message queue messages are for application to application communications. The applications have to be able to programmatically interpret the results of the message. This is more than just interpreting the body of the message. If a message cannot be delivered, then the human can generally figure out why from the text in the response. A message queue message has to provide this type of information in a standard way that the application reading the message can understand.

In the body of an e-mail message, the content is understandable by anyone who can understand the language it is written in. That is, unless the message body is encrypted. In a message queue message, the content is only understood by the sending application and the receiving application. This means that intercepting a message between two systems is useless unless you know exactly how to interpret the message. Another by-product of this is that the message can be made very concise. The information can be in shorthand known by the two applications, rather than in verbose text that has to be understood by humans.

A message queue system also has more safeguards in place to ensure that a message arrives at its destination. With e-mail, especially over the Internet, reliable delivery is not something one can always count on. Message queuing systems have the capability to ensure that a message arrives at its destination. There are two types of delivery methods that are supported MSMQ: Express and Recoverable. An Express message is one that resides only in memory, thereby consuming fewer resources and being able to move through the message queuing system faster. The other type of message, a recoverable message, is written to permanent storage at every step from the sender to the destination.

This means that if you have two messages, one Express and one Recoverable, that are in a queue server waiting to be routed to another queue server, and that queue server dies, the express message will die with it. Since there is no copy of the message written to permanent storage, it will be lost. The recoverable message, having been stored by the server, will be restored once the server is restarted. It is up to the sender of the message, based on the performance vs. reliability tradeoff, to determine the message type for each message being sent.

© 1998 by Wrox Press. All rights reserved.