Message Queues

There are two primary components that make a message queuing system. One of these is, of course, a message. A message is a piece of information or data that is sent between two computers. The data can either be text or binary. The other component of the system is the queue. A queue is a container that can hold messages. Applications can then either put messages into a queue or read messages from a queue.

Message Content

A message is made up of a number of different components. The main part of the message is its content. As stated before, the message can either be text or binary data. The format of the content is determined by the two applications that are passing the message between themselves. There is no standard method for formatting the content of a message. This means that, unlike an e-mail system, where parts of the body of the message can be interpreted by the system, the only applications that can read the contents of the message are those that know exactly what the content consists of.

A message also consists of information about who the sender and the receiver are. It will also include a timestamp as to when it was sent. Some messages can include an expiration date, after which if they are not read, they will be deleted.

Message Queue

A message queue is where a message is sent until it is picked up by the destination application. In this case, the message queue is similar to a set of office mail slots. In an office mail slot, everyone has a slot, and to get a document to someone else, you put it in their slot. Later, they can come by and pick up all of their messages. In a message queuing system, messages will be placed in a queue until the destination application explicitly asks for the message. If there is a failure on the system that is holding the queues, then when the system restarts the queues will automatically be restored to their state before the crash. If there is a failure during the transmission of the message, the last server to have a valid copy of the message before the crash will be able to send it on its way once the system is restored.

There can be one or more queues in a system. The Microsoft Message Queue System actually supports vast hierarchies of systems that are connected together. This is beyond the scope of this chapter. However, on a single machine, the queue manager application manages all of the queues on that machine. It is up to the queue manager to determine if the destination of a message is local or not. If it is local, it simply drops the message in its destination queue, which it is also managing. If it is not local, then it locates the machine where the destination queue is by using a directory server. It then negotiates the transfer of that message with the destination machine's queue manager. Once the destination queue manager receives the message, it then deposits it in the destination queue.

© 1998 by Wrox Press. All rights reserved.