Locating Queues

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

Message Queuing provides a way to query the directory service for a set of public queues based on properties of the queues. For example, an application could query the directory service for all the public queues with a specific label or query the directory service for a public queue with a specific queue identifier.

Note

Public queues in Windows® 2000 and Windows Server 2003 enterprises can also be located through the Active Directory Service Interfaces (ADSI). When Message Queuing is deployed in a Windows 2000 or Windows Server 2003 enterprise, public queues are registered in Active Directory Domain Services (AD DS). An example of using ADSI to locate queues is included in Locating Queue Examples.

MSMQ 3.0 also provides a mechanism for locating private queues. For more information, see PROPID_MGMT_MSMQ_PRIVATEQ and MSMQApplication.PrivateQueues.

The illustration below shows a query that locates two queues based on their service type GUID. In this case, the calling application could open either queue to send or read messages (this type of query could be used to provide load balancing when sending messages to queues on different computers).

Note

It does not matter where the messages that compose the queue are stored. The only requirement is that the queues are registered in the directory service and that Message Queuing has access to the directory service.

<No Change>

Note

Queries cannot be made when the computer is operating in workgroup mode or while the computer is operating offline. Message Queuing must have access to the directory service to query the directory service.

Calls to Locate Public Queues

The API functions and COM methods used to locate public queues are listed below:

The process that the calling application must follow to perform a query differs slightly depending on what type of calls are made. These differences are summarized below:

  • API function calls

    The search criteria can be any valid queue property other than the path name of the queue, and the calling application must specify which queue properties that it wants Message Queuing to return as query results.

  • COM method calls

    The search criteria are limited to the queue label, queue identifier, service type, create time, modify time, and multicast address. Message Queuing returns an MSMQQueueInfos object that defines a query and provides methods that query the directory service and return a MSMQQueueInfo object for each queue found in the query.

However, regardless of which type of calls are used, the basic idea is that the calling application specifies the search criteria for the query; runs the query; then performs some action, such as sending a message to one of the returned queues, based on the queue information returned by Message Queuing.

For information on See
What is required to locate queues using API function calls Locating Queues Using Function Calls
What is required to locate queues using COM component calls Locating Queues Using COM Component Calls
Example code for locating queues Locating Queue Examples