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

Retrieves all public queues on the specified computer.

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

Parameters

machineName
The name of the computer from which to get the public queues.

Return Value

An array of MessageQueue objects that reference the public queues on the computer.

Remarks

Use this method to filter public queues by computer.

GetPublicQueuesByMachine returns a static snapshot of the queues. To interact with a dynamic queue list, use GetMessageQueuesEnumerator. You can specify the computer name as part of the MessageQueueCriteria passed in.

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

GetPublicQueuesByMachine 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 retrieves an array containing all the public queues available on a specified computer. A message is sent to each public queue on the computer.

[Visual Basic]

Private Sub SearchMachineForQueue(ByVal computerName As String, ByVal queueName As String)
    'Create an array to hold the set of message queue objects
    Dim mqList() As MessageQueue

    'The following integer is used in the for loop
    Dim i As Integer

    'Get an array of public queues on the computer
    mqList = MessageQueue.GetPublicQueuesByMachine("myComputer")
    'Send a message to each public queue.
    For i = 0 To mqList.Length - 1
        mqList(i).Send("Broadcast message sent to queue.")
    Next
End Sub

See Also

MessageQueue Class | MessageQueue Members | System.Messaging Namespace | MachineName | GetPublicQueues | GetPublicQueuesByLabel | GetPublicQueuesByCategory