Chapter 45

Message Queuing

System.Messaging is a namespace that includes classes for reading and writing messages with the Message Queuing facility of the Windows operating system. Messaging can be used in a disconnected scenario where the client and server needn’t be running at the same time.

This chapter looks at the following topics:

  • An overview of Message Queuing
  • Message Queuing architecture
  • Message queue administrative tools
  • Programming Message Queuing
  • Course order sample application
  • Message Queuing with WCF

Overview

Before diving into programming Message Queuing, this section discusses the basic concepts of messaging and compares it to synchronous and asynchronous programming. With synchronous programming, when a method is invoked, the caller has to wait until the method is completed. With asynchronous programming, the calling thread starts the method that runs concurrently. Asynchronous programming can be done with delegates, class libraries that already support asynchronous methods (for example, Web service proxies, System.Net, and System.IO classes), or by using custom threads (see Chapter 19, “Threading and Synchronization”). With both synchronous and asynchronous programming, the client and the server must be running at the same time.

Although Message Queuing operates asynchronously, because the client (sender) does not wait for the server (receiver) to read the data sent to it, there is a crucial difference between Message Queuing and asynchronous programming: Message ...

Get Professional C# 2008 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.