Message Queuing and MSMQ
This section introduces message queuing and MSMQ and explains why message queuing technology and products can overcome the shortcomings of the synchronous processing model.
Asynchronous Processing and Message Queuing
As you can see from the previous discussion, a tightly coupled architecture is not suitable for today's distributed applications, such as Windows DNA applications. In a typical DNA application, having a reliable network connection, available servers, and so on is not always feasible. Message queuing, on the other hand, provides an asynchronous processing model that addresses the limitations of the synchronous processing model.
Message queuing products use a store-and-forward mechanism to handle the interaction between different applications. In a typical message queuing system, like the one in Figure 3.2, instead of calling the server directly as in DCOM applications, the client sends data in the form of a message to a temporary data store, which is called a queue. The underlying message queuing service internally forwards the message to another queue on the server. A receiver application on the server then picks up the message from the queue and invokes the server to process.
As shown in Figure 3.2, the request of the client is processed in a loosely coupled, asynchronous manner. An asynchronous system such as message queuing can be configured in such a way that if the network is down, the message stays in the queue on the client machine and the data is not lost. The message queuing service forwards the message to the server queue if the network connection becomes available again. The receiver application on the server machine can pick up and process the message at another time. Finally, as long as the client application sends the message to the queue, it is ready to do whatever else it needs to do because it's not blocked by the server process any more.
The terms client and client application here simply mean the message sender. They are relative terms. The roles of the sender and the receiver can be reversed.
The configuration described here is called an independent client in MSMQ. In the IBM MQSeries system, you can use clustering queue managers to achieve the same results. IBM MQSeries, which is IBM's message queuing product, offers capabilities comparable to MSMQ. I will discuss only MSMQ in this book, because this chapter is intended to give you all the background information for Chapter 9, "Queued Components." Queued Components is an important COM+ services that uses MSMQ to achieve messaging queuing functionality.
Message queuing products are sometimes referred to as Message-Oriented Middleware (MOM). Microsoft Message Queue Services 2.0 is now an integrated part of Windows 2000 component services; it is the Microsoft implementation of MOM technology.
Applications developed for MSMQ can communicate across heterogeneous networks and with computers that may be offline. MSMQ provides guaranteed message delivery, efficient routing, security, transactional support, and priority-based messaging.
In Microsoft Windows 2000 documentation, MSMQ 2.0 is referred to as message queuing. In Microsoft Platform SDK documentation, both terms (MSMQ, and message queuing) are used.