Chapter 14 Building Asynchronous Applications With Message Queues

Team Fly 

Page 341

Chapter 14
Building Asynchronous Applications With Message Queues

WHILE MOST PROGRAMMING TASKS are synchronous, there are situations when we must implement asynchronous systems. An asynchronous system involves two or more computers that must exchange information, but we can't assume that they're always connected, or that each system will perform certain tasks in a timely manner. In an asynchronous system, we should be able to send a request from one computer to another and be sure that the computer that receives the request will eventually process it. A web server that accepts orders does not usually process them. The orders are forwarded to another machine to be processed, and this machine is usually on a different network. The processing of an order may actually involve communication with a remote system as well (ordering an out-of-stock item from its publisher, or placing large orders to a warehouse) and it may take a while to complete. The computers involved in an operation may not be connected at all times, or one of the computers may take a while to perform a task. The other computers involved in the process shouldn't have to wait for each task to complete.

In this sense, the architecture just described is that of an asynchronous system. More specifically, it's a loosely coupled system. In such a system we assume that all resources are available, but not necessarily at all times. Applications for systems consisting of multiple computers that communicate with one another are based on a so-called loosely coupled architecture. In English, this term means that the various components of the system are connected to one another, but they operate independently of one another and they may disconnect at any time. This architecture requires a secure, reliable mechanism for the system's parts to exchange information. This mechanism is provided by the Microsoft Message Queuing (MSMQ) component, which comes with both Windows 2000 and Windows XP, but it's an optional component that you will have to install through the Add/Remove Windows Components tool. The basic functionality of MSMQ is to set up queues, send messages to these queues, and receive messages from the same queues. Your application will create messages and send them to a specific queue. After that, MSMQ takes over and makes sure that the message is delivered to the destination queue. If the message can't be

Team Fly 


Visual Basic  .NET Power Tools
Visual Basic .NET Power Tools
ISBN: 0782142427
EAN: 2147483647
Year: 2003
Pages: 178

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