NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

MessageQueue.GetPublicQueuesByLabel

Retrieves a set of public queues filtered by the specified label.

[Visual Basic]
Public Shared Function GetPublicQueuesByLabel( _
   ByVal label As String _
) As MessageQueue ()
[C#]
public static MessageQueue[] GetPublicQueuesByLabel(
   string label
);
[C++]
public: static MessageQueue* GetPublicQueuesByLabel(
   String* label
) [];
[JScript]
public static function GetPublicQueuesByLabel(
   label : String
) : MessageQueue[];

Parameters

label
The label that is used to filter the queues.

Return Value

An array of MessageQueue objects that reference the public queues retrieved.

Remarks

Use this method to filter public queues by label.

GetPublicQueuesByLabel retrieves a static snapshot of the queues. To interact with a dynamic queue list, use GetMessageQueuesEnumerator. You can specify the label as part of the MessageQueueCriteria passed in.

GetPublicQueuesByLabel can not be used to retrieve private or system queue information.

GetPublicQueuesByLabel is a static (in Visual Basic Shared) member, so it can be called using the MessageQueue class itself. It is not necessary to create an instance of MessageQueue in order to call the method.

Example [Visual Basic]

The following example finds all public queues with the Label "My Queue", places them in an array of MessageQueue objects, and sends a broadcast message to these queues. These queues can be on multiple computers.

[Visual Basic]

Private Sub SearchPublicQueuesByLabel()
    'Create an array to hold the set of message queue objects.
    Dim mqList() As MessageQueue
    'This is used in the For loop.
    Dim i As Integer

    'Get an array of queues with the given label.
    mqList = MessageQueue.GetPublicQueuesByLabel("My Queue")

    'Iterate through the queue list to send a message to each queue.
    For i = 0 To mqList.Length - 1
        'Send a message to each queue. This may involve multiple computers.    
        mqList(i).Send("Broadcast message to queues with label My Queue")
    Next
End Sub

See Also

MessageQueue Class | MessageQueue Members | System.Messaging Namespace | Label | GetPublicQueues | GetPublicQueuesByMachine | GetPublicQueuesByCategory