A message is a unit of data sent between two computers. A message can be very simple, consisting of just a string of text, or more complex, possibly involving embedded objects.
Messages are sent to queues. A message queue is a container that holds messages while they are in transit. The Message Queue Manager acts as the middleman in relaying a message from its source to its destination. A queue's main purpose is to provide routing and guarantee the delivery of messages; if the recipient is not available when a message is sent, the queue holds the message until it can be successfully delivered.
Message Queuing, Microsoft's messaging technology, provides messaging and message queue facilities for any application and among any combination of computers that have Microsoft Windows installed, regardless of whether they are on the same network or online at the same time.
A Message Queuing network is any set of computers that are enabled to send messages back and forth to one another. Different computers in the network play different roles in ensuring that messaging proceeds smoothly. Some provide routing information to determine how messages are sent, some hold key information for the entire network, and some simply send and receive messages.
During Message Queuing setup, an administrator makes decisions about which servers can communicate with each other and sets up special roles for specific servers. The computers that make up this Message Queuing network are called sites , and they are connected to one another by site links . Each site link has an associated cost, determined by the administrator, that indicates how quickly messages can be passed across it.
The Message Queuing administrator also sets up one or more computers in the network to act as routing servers. A routing server makes decisions about how a message is delivered by looking at the cost of various site links and determining the quickest and most efficient way to deliver the message across multiple sites.
You do not need to worry about the details of message routing during development, because administrators can tune your Message Queuing network for efficient message delivery.
Types of Queues
There are two main categories of queues: queues that you or other users of the network create, and system queues. The following are queues that lists all types of queues:
Most of the work you do in your applications will involve accessing public queues and their messages. However, you will most likely use several different kinds of the system queues in your day-to-day operations, depending on your application's need for journal recording, acknowledgement , and other special processing.
Interacting with Message Queues
Messaging provides a powerful and flexible mechanism for interprocess communication between components of a server-based application. It has several advantages over direct calls between components, including
You must install Message Queuing on your client computer (which in this case is the participating server, not an arbitrary machine with a browser). When you install Message Queuing, you select the primary Message Queuing server to which you want to connect. You cannot view or manipulate queues that reside on another primary Message Queuing server.
Message Queuing can be run in either a domain or a workgroup environment. In the context of Message Queuing, a domain environment includes domain controllers that provide a directory service such as Active Directory, and a workgroup environment is any environment that does not provide such a directory service.
You can create MessageQueue components in both Web applications and Windows applications built with the common language runtime.
Synchronous and Asynchronous Communication
Queue communication is inherently asynchronous, in that messages are sent to a queue and received from a queue in separate processes. In addition, you can perform receive operations asynchronously, in that the person who wants to receive a message can call the BeginReceive method for any given queue and then immediately go on to other tasks without waiting for a reply. This is very different from what is known as synchronous communication .
In synchronous communication, the sender of a request must wait for a response from the intended receiver before performing other tasks. The amount of time that the sender must wait depends entirely on the amount of time it takes for the receiver to process the request and send a response.
Synchronous or asynchronous retrieval of messages is a separate issue from sending messages. Messages are always sent asynchronously.
You can help secure the content of messages that you send and receive in the following ways:
I plan to add additional information and examples to the Web site at www.UsingASP.net. Look for more information there after you read through this chapter.
Installing Message Queuing
You must have Message Queuing installed on your development computer if you want to work with Message Queues. You can find instructions on installing Message Queuing in your Windows 2000 or Windows NT documentation. When you install, you must specify whether the new primary Message Queuing server you are creating will act as the hub of a new network, an independent client of an existing network, or a dependent client of an existing network. During initial development, you'll create a network with which you'll develop later. You'll join the existing Message Queuing network for your company or workgroup.