Message Queues

Message queues provide applications with a way to exchange information through messages. Applications can send messages to these queues and read the messages they contain. The following illustration shows a single message queue with one application sending messages to the queue and another application reading its messages.

However, this illustration does not indicate where messages are stored. A queue's messages are stored on the computer designated when the queue is created.

To an application, the most important classifications of these queues are whether they are public or private. Although both public and private queues have significant advantages, the choice to make a queue public or private depends on whether you want others to be able to locate the queue.

The advantage of public queues is that they are registered in Active Directory so they can be located by any MSMQ application. They are persistent, and their registration information can be backed up on your enterprise, making them good for long-term use.

Private queues are registered on the local computer and typically cannot be seen by other applications. To register a private queue, MSMQ stores a description of the queue (plus cached information about any local public queues) in the LQS (local queue storage) directory on the local computer (the default LQS directory is \program files\msmq\storage\lqs). Private queues do have the advantage of no Active Directory overhead (faster to create, no latency, and no replication), and they can be created and deleted when the Active Directory is not working.

Private queues can be exposed to other applications if the queue's location is sent to the other application. This is done by sending the private queue's format name to the other application. (For applications using API functions, see PROPID_M_RESP_QUEUE. For applications using ActiveX components, see ResponseQueueInfo).

For a C API example of… See…
Creating a public or private queue Creating a Queue
Locating a public queue Locating a Public Queue (using API functions)
Opening a queue Opening a Queue
Sending messages to a queue Sending Messages to a Queue

For an ActiveX example of… See…
Creating a public or private queue Creating a Queue
Locating a public queue Locating a Public Queue
Sending messages to a queue Sending Messages to a Queue