Compartir a través de


Message Queues and Messaging Technology Backgrounder 

Microsoft Windows Message Queuing makes it easy for application developers to communicate with application programs quickly and reliably by sending and receiving messages. If you are unfamiliar with MessageQueue technology, this page provides a brief overview of essential terms and concepts.

Key Concepts in Messaging

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, the Microsoft messaging technology, provides messaging and message queue facilities for any application. And it also provides messaging and facilities 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.

The following picture shows a typical configuration of Message Queuing sites and how they interact:


Message routing between sites

Routing Messages

NoteTip

You do not need to worry about the details of message routing during development, because your Message Queuing network can be tuned by administrators 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. User-created queues can be any of the following:

  • Public queues are replicated throughout the Message Queuing network and can potentially be accessed by all of the sites connected by the network.

  • Private queues are not published across the entire network. Instead they are available only on the local computer that contains them. Private queues can be accessed only by applications that know the full path name or label of the queue.

  • Administration queues contain messages acknowledging the receipt of messages sent within a given Message Queuing network. You specify the administration queue you want your MessageQueue components to use, if any.

  • Response queues contain response messages that are returned to the sending application when the message is received by the destination application. You specify the response queue you want your MessageQueue components to use, if any.

System-generated queues generally fall in one of the following categories:

  • Journal queues optionally store copies of messages that you send and copies of messages removed from a queue. A single journal queue on each Message Queuing client stores copies of messages sent from that computer. On the server, a separate journal queue is created for each individual queue. This journal tracks messages removed from that queue.

  • Dead-letter queues store copies of undeliverable or expired messages. If the expired or undeliverable message was a transactional message, it is stored in a special kind of dead-letter queue called a transaction dead-letter queue. Dead letters are stored on the computer on which the message expired. For more information on time-out periods and expired messages, see Default Message Properties.

  • Report queues contain messages that indicate the route a message took to its destination, and can also contain test messages. There can be only one report queue per computer.

  • Private system queues are a series of private queues that store administrative and notification messages that the system needs to process messaging actions.

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.

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. 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.

NoteNote

Synchronous or asynchronous retrieval of messages is a separate issue from sending messages. Messages are always sent asynchronously.

For more information on asynchronous processing in message queues, see Asynchronous Message Processing.

Message Security

You can help secure the content of messages that you send and receive in the following ways:

  • You can use authentication to verify the source of messages your applications receive.

  • You can use encryption to ensure that your messages cannot be read or used by unauthorized persons.

  • You can use access control rights to restrict users with ACL-based security and to restrict code with code access security from sending messages to—or reading messages from—a particular queue on a computer.

  • You can use auditing to record which users attempt to access Message Queuing objects, the type of operation attempted, and if that access succeeded or failed.

For more information, see Message Queue Security.

Installing Message Queuing

You must have Message Queuing installed on your development computer if you want to work with message queues either in code or in Server Explorer. You can find instructions on installing Message Queuing in your Windows 2000 or Windows NT documentation. When you install, you must specify whether you are creating a new primary Message Queuing server that will act as the hub of a new network, an independent client of an existing network, or a dependent client of an existing network. In most cases you will not create a new network, but will join the existing Message Queuing network for your company or workgroup.

Where to Go for Background Reading

The remaining pages in this section provide you with the information you need to use Message Queuing components in your applications. If you need more information on messaging technologies outside the context of Visual Studio or the .NET Framework, there are many sources of information available to you in the MSDN library and on the Microsoft Web site:

For information about See this page in your Windows 2000 Server documentation

Setting up a Message Queuing network

Installing Message Queuing

General Message Queuing concepts

Understanding Message Queuing

Fine-tuning Message Queuing performance

Administering Message Queuing

See Also

Other Resources

Using Messaging Components