The Role of Messaging in a Distributed System

Conceptually, Message Queuing is quite simple. Ordinary interaction with an object works like a telephone call: both the client and server participate in a real-time exchange of information. Calling a remote component or XML Web service is conceptually the same.

Technically, an XML Web service call is an exchange of a request and response message. In the .NET way of thinking, these two steps are tightly bound together into a single operation. The proxy class sends a request message and stops to wait for a response message before execution can continue. This guarantees that a certain unit of time is always spent waiting for the server to complete its work.

Messaging is more like sending a fax or an e-mail. A message is sent, and no response is returned (although one might be expected at a later time). The recipient is free to deal with the message immediately or ignore it entirely. The client continues independently, without being notified about the success of the operation or its outcome. However, some messaging services can provide features such as guaranteed delivery or message confirmation for critical tasks.

Clearly, messaging is poorly suited to tasks in which the client needs an immediate answer. However, messaging is ideal in situations where the client just needs to trigger an action or submit a request. When used for this purpose, messaging is fast and efficient because no waiting is required. Messaging is also extremely scalable because an application can receive dozens of messages in an instant and set them all aside for later processing. The message recipient has the luxury of choosing how and when to deal with the received messages. In return, clients don't have to worry about being tied up waiting for a long call to complete if the server is already dealing with several other requests.

Some ideal scenarios for messaging include the following:

  • Submitting an order

    Before a typical order can be shipped, a credit check must be made, an inventory check must be made, and a shipping date must be set. These steps can take time. Using messaging ensures that orders aren't lost and client applications aren't delayed in peak times. If the server is in high demand for other tasks, you can even perform all the work during off-hours.

  • Submitting information

    For example, a workstation might regularly send data to a remote component, which will be collected and analyzed later. A specialized example of this pattern is with a scientific surveying/monitoring tool that periodically sends a measurement. The method that receives this data is an ideal candidate for a fire-and-forget method.

  • A work-request system

    With asynchronous messaging, the server-side component can decide what requests to process first (perhaps depending on the priority) and where to store the information (perhaps in a back-end database). However, there's no way to issue a ticket, so clients will need to supply their own identifiers.



Microsoft. NET Distributed Applications(c) Integrating XML Web Services and. NET Remoting
MicrosoftВ® .NET Distributed Applications: Integrating XML Web Services and .NET Remoting (Pro-Developer)
ISBN: 0735619336
EAN: 2147483647
Year: 2005
Pages: 174

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