MessageQueue.GetMessageQueueEnumerator Methode

Definitie

Hiermee maakt u een enumerator-object voor een dynamische lijst van de openbare wachtrijen op het netwerk.

Overloads

Name Description
GetMessageQueueEnumerator()

Biedt semantiek voor alleen-doorstuurservers om alle openbare wachtrijen op het netwerk op te sommen.

GetMessageQueueEnumerator(MessageQueueCriteria)

Biedt semantiek voor alleen-doorstuurservers om alle openbare wachtrijen in het netwerk op te sommen die voldoen aan de opgegeven criteria.

GetMessageQueueEnumerator()

Biedt semantiek voor alleen-doorstuurservers om alle openbare wachtrijen op het netwerk op te sommen.

public:
 static System::Messaging::MessageQueueEnumerator ^ GetMessageQueueEnumerator();
public static System.Messaging.MessageQueueEnumerator GetMessageQueueEnumerator();
static member GetMessageQueueEnumerator : unit -> System.Messaging.MessageQueueEnumerator
Public Shared Function GetMessageQueueEnumerator () As MessageQueueEnumerator

Retouren

Een MessageQueueEnumerator die een dynamische lijst biedt van alle openbare berichtenwachtrijen op het netwerk.

Voorbeelden

In het volgende codevoorbeeld worden alle berichtenwachtrijen in het netwerk herhaald en wordt het pad voor elke wachtrij onderzocht. Ten slotte wordt het aantal openbare wachtrijen op het netwerk weergegeven.

#using <System.dll>
#using <System.Messaging.dll>

using namespace System;
using namespace System::Messaging;

//**************************************************
// Iterates through message queues and examines the
// path for each queue. Also displays the number of
// public queues on the network.
//**************************************************
void ListPublicQueues()
{
   
   // Holds the count of private queues.
   int numberQueues = 0;
   
   // Get a cursor into the queues on the network.
   MessageQueueEnumerator^ myQueueEnumerator = MessageQueue::GetMessageQueueEnumerator();
   
   // Move to the next queue and read its path.
   while ( myQueueEnumerator->MoveNext() )
   {
      
      // Increase the count if priority is Lowest.
      Console::WriteLine( myQueueEnumerator->Current->Path );
      numberQueues++;
   }

   
   // Display final count.
   Console::WriteLine( "Number of public queues: {0}", numberQueues );
   return;
}


//**************************************************
// Provides an entry point into the application.
//   
// This example uses a cursor to step through the
// message queues and list the public queues on the
// network.
//**************************************************
int main()
{
   
   // Output the count of Lowest priority messages.
   ListPublicQueues();
}
using System;
using System.Messaging;

namespace MyProject
{
    /// <summary>
    /// Provides a container class for the example.
    /// </summary>
    public class MyNewQueue
    {

        //**************************************************
        // Provides an entry point into the application.
        //		
        // This example uses a cursor to step through the
        // message queues and list the public queues on the
        // network.
        //**************************************************

        public static void Main()
        {
            // Create a new instance of the class.
            MyNewQueue myNewQueue = new MyNewQueue();

            // Output the count of Lowest priority messages.
            myNewQueue.ListPublicQueues();
                        
            return;
        }

        //**************************************************
        // Iterates through message queues and examines the
        // path for each queue. Also displays the number of
        // public queues on the network.
        //**************************************************
        
        public void ListPublicQueues()
        {
            // Holds the count of private queues.
            uint numberQueues = 0;
    
            // Get a cursor into the queues on the network.
            MessageQueueEnumerator myQueueEnumerator =
                MessageQueue.GetMessageQueueEnumerator();

            // Move to the next queue and read its path.
            while(myQueueEnumerator.MoveNext())
            {
                // Increase the count if priority is Lowest.
                Console.WriteLine(myQueueEnumerator.Current.Path);
                numberQueues++;
            }

            // Display final count.
            Console.WriteLine("Number of public queues: " +
                numberQueues.ToString());
            
            return;
        }
    }
}
Imports System.Messaging



Public Class MyNewQueue


        
        ' Provides an entry point into the application.
        '		 
        ' This example uses a cursor to step through the
        ' message queues and list the public queues on the
        ' network.
        

        Public Shared Sub Main()

            ' Create a new instance of the class.
            Dim myNewQueue As New MyNewQueue()

            ' Output the count of Lowest priority messages.
            myNewQueue.ListPublicQueues()

            Return

        End Sub


        
        ' Iterates through message queues and examines the
        ' path for each queue. Also displays the number of
        ' public queues on the network.
        

        Public Sub ListPublicQueues()

            ' Holds the count of private queues.
            Dim numberQueues As Int32 = 0

            ' Get a cursor into the queues on the network.
            Dim myQueueEnumerator As MessageQueueEnumerator = _
                MessageQueue.GetMessageQueueEnumerator()

            ' Move to the next queue and read its path.
            While myQueueEnumerator.MoveNext()
                ' Increase the count if the priority is Lowest.
                Console.WriteLine(myQueueEnumerator.Current.Path)
                numberQueues += 1
            End While

            ' Display final count.
            Console.WriteLine(("Number of public queues: " + _
                numberQueues.ToString()))

            Return

        End Sub

End Class

Opmerkingen

Deze overbelasting van GetMessageQueueEnumerator retourneert een opsomming van alle openbare wachtrijen die zich in het netwerk bevinden.

Omdat de cursor is gekoppeld aan een dynamische vermelding, weerspiegelt de opsomming alle wijzigingen die u aanbrengt in een wachtrijlijst voor wachtrijen die zijn verwijderd of toegevoegd buiten de huidige positie van de cursor. Toevoegingen of verwijdering van wachtrijen die zich bevinden voordat de huidige positie van de cursor niet wordt weergegeven. De enumerator heeft bijvoorbeeld automatisch toegang tot een wachtrij die is toegevoegd buiten de cursorpositie, maar niet tot een wachtrij die vóór die positie is ingevoegd. U kunt de opsomming echter opnieuw instellen, waardoor de cursor weer naar het begin van de lijst wordt verplaatst door het aanroepen van Reset de MessageQueueEnumeratorlijst.

Er is geen gedefinieerde volgorde van wachtrijen in een netwerk. Een enumerator bestelt ze niet, bijvoorbeeld op computer, label, openbare of persoonlijke status, of andere toegankelijke criteria.

Als u een statische momentopname van de wachtrijen in het netwerk wilt in plaats van een dynamische verbinding met deze wachtrijen, roept GetPublicQueues u aan of GetPrivateQueuesByMachine(String). Elk van deze twee methoden retourneert een matrix met MessageQueue objecten, die de wachtrijen vertegenwoordigen op het moment dat de methode werd aangeroepen.

In de volgende tabel ziet u of deze methode beschikbaar is in verschillende werkgroepmodi.

Werkgroepmodus Available
Lokale computer No
Naam van lokale computer en directe indeling No
Externe computer No
Naam van externe computer en directe indeling No

Zie ook

Van toepassing op

GetMessageQueueEnumerator(MessageQueueCriteria)

Biedt semantiek voor alleen-doorstuurservers om alle openbare wachtrijen in het netwerk op te sommen die voldoen aan de opgegeven criteria.

public:
 static System::Messaging::MessageQueueEnumerator ^ GetMessageQueueEnumerator(System::Messaging::MessageQueueCriteria ^ criteria);
public static System.Messaging.MessageQueueEnumerator GetMessageQueueEnumerator(System.Messaging.MessageQueueCriteria criteria);
static member GetMessageQueueEnumerator : System.Messaging.MessageQueueCriteria -> System.Messaging.MessageQueueEnumerator
Public Shared Function GetMessageQueueEnumerator (criteria As MessageQueueCriteria) As MessageQueueEnumerator

Parameters

criteria
MessageQueueCriteria

Een MessageQueueCriteria met de criteria die worden gebruikt om de beschikbare berichtenwachtrijen te filteren.

Retouren

Een MessageQueueEnumerator die een dynamische lijst biedt van de openbare berichtenwachtrijen in het netwerk die voldoen aan de beperkingen die zijn opgegeven door de criteria parameter.

Voorbeelden

In het volgende codevoorbeeld worden berichtenwachtrijen herhaald en wordt het pad weergegeven van elke wachtrij die is gemaakt op de laatste dag en die bestaat op de computer 'MyComputer'.

#using <system.dll>
#using <system.messaging.dll>

using namespace System;
using namespace System::Messaging;
ref class MyNewQueue
{
public:

   // Iterates through message queues and displays the
   // path of each queue that was created in the last
   // day and that exists on the computer "MyComputer". 
   void ListPublicQueuesByCriteria()
   {
      UInt32 numberQueues = 0;
      
      // Specify the criteria to filter by.
      MessageQueueCriteria^ myCriteria = gcnew MessageQueueCriteria;
      myCriteria->MachineName = "MyComputer";
      myCriteria->CreatedAfter = DateTime::Now.Subtract( TimeSpan(1,0,0,0) );
      
      // Get a cursor into the queues on the network.
      MessageQueueEnumerator^ myQueueEnumerator = MessageQueue::GetMessageQueueEnumerator( myCriteria );
      
      // Move to the next queue and read its path.
      while ( myQueueEnumerator->MoveNext() )
      {
         
         // Increase the count if priority is Lowest.
         Console::WriteLine( myQueueEnumerator->Current->Path );
         numberQueues++;
      }

      
      // Handle no queues matching the criteria.
      if ( numberQueues == 0 )
      {
         Console::WriteLine( "No public queues match criteria." );
      }

      return;
   }

};

int main()
{
   
   // Create a new instance of the class.
   MyNewQueue^ myNewQueue = gcnew MyNewQueue;
   
   // Output the count of Lowest priority messages.
   myNewQueue->ListPublicQueuesByCriteria();
   return 0;
}
using System;
using System.Messaging;

namespace MyProject
{
    /// <summary>
    /// Provides a container class for the example.
    /// </summary>
    public class MyNewQueue
    {

        //**************************************************
        // Provides an entry point into the application.
        //		
        // This example uses a cursor to step through the
        // message queues and list the public queues on the
        // network that specify certain criteria.
        //**************************************************

        public static void Main()
        {
            // Create a new instance of the class.
            MyNewQueue myNewQueue = new MyNewQueue();

            // Output the count of Lowest priority messages.
            myNewQueue.ListPublicQueuesByCriteria();
                        
            return;
        }

        //**************************************************
        // Iterates through message queues and displays the
        // path of each queue that was created in the last
        // day and that exists on the computer "MyComputer".
        //**************************************************
        
        public void ListPublicQueuesByCriteria()
        {
            uint numberQueues = 0;
            
            // Specify the criteria to filter by.
            MessageQueueCriteria myCriteria = new
                MessageQueueCriteria();
            myCriteria.MachineName = "MyComputer";
            myCriteria.CreatedAfter = DateTime.Now.Subtract(new
                TimeSpan(1,0,0,0));

            // Get a cursor into the queues on the network.
            MessageQueueEnumerator myQueueEnumerator =
                MessageQueue.GetMessageQueueEnumerator(myCriteria);

            // Move to the next queue and read its path.
            while(myQueueEnumerator.MoveNext())
            {
                // Increase the count if priority is Lowest.
                Console.WriteLine(myQueueEnumerator.Current.Path);
                numberQueues++;
            }

            // Handle no queues matching the criteria.
            if (numberQueues == 0)
            {
                Console.WriteLine("No public queues match criteria.");
            }

            return;
        }
    }
}
Imports System.Messaging

 
Public Class MyNewQueue


        '
        ' Provides an entry point into the application.
        '		 
        ' This example uses a cursor to step through the
        ' message queues and list the public queues on the
        ' network that specify certain criteria.
        

        Public Shared Sub Main()

            ' Create a new instance of the class.
            Dim myNewQueue As New MyNewQueue()

            ' Output the count of Lowest priority messages.
            myNewQueue.ListPublicQueuesByCriteria()

            Return

        End Sub


        
        ' Iterates through message queues and displays the
        ' path of each queue that was created in the last
        ' day and that exists on the computer "MyComputer". 
        

        Public Sub ListPublicQueuesByCriteria()

            Dim numberQueues As Int32 = 0

            ' Specify the criteria to filter by.
            Dim myCriteria As New MessageQueueCriteria()
            myCriteria.MachineName = "MyComputer"
            myCriteria.CreatedAfter = DateTime.Now.Subtract(New _
                TimeSpan(1, 0, 0, 0))


            ' Get a cursor into the queues on the network.
            Dim myQueueEnumerator As MessageQueueEnumerator = _
                MessageQueue.GetMessageQueueEnumerator(myCriteria)

            ' Move to the next queue and read its path.
            While myQueueEnumerator.MoveNext()
                ' Increase the count if the priority is Lowest.
                Console.WriteLine(myQueueEnumerator.Current.Path)
                numberQueues += 1
            End While

            ' Handle no queues matching the criteria.
            If numberQueues = 0 Then
                Console.WriteLine("No queues match the criteria.")
            End If

            Return

        End Sub

End Class

Opmerkingen

Deze overbelasting van GetMessageQueueEnumerator retourneert een lijst met alle openbare wachtrijen op het netwerk die voldoen aan criteria die zijn gedefinieerd in de toepassingscriteria. U kunt de criteria opgeven die moeten worden opgenomen, bijvoorbeeld het maken of wijzigen van de wachtrij, computernaam, label, categorie of een combinatie hiervan.

Omdat de cursor is gekoppeld aan een dynamische vermelding, weerspiegelt de opsomming alle wijzigingen die u aanbrengt in een wachtrij die zich buiten de huidige positie van de cursor bevindt. Wijzigingen in wachtrijen die zich bevinden voordat de huidige positie van de cursor niet wordt weergegeven. De enumerator heeft bijvoorbeeld automatisch toegang tot een wachtrij die is toegevoegd buiten de cursorpositie, maar niet tot een wachtrij die vóór die positie is ingevoegd. U kunt de opsomming echter opnieuw instellen, waardoor de cursor weer naar het begin van de lijst wordt verplaatst door het aanroepen van Reset de MessageQueueEnumeratorlijst.

Er is geen gedefinieerde volgorde van wachtrijen in een netwerk. Een enumerator bestelt ze niet, bijvoorbeeld op computer, label, openbare of persoonlijke status, of andere toegankelijke criteria.

Als u een statische momentopname van de wachtrijen in het netwerk wilt in plaats van een dynamische verbinding met deze wachtrijen, geeft u criteria op voor GetPublicQueues of aanroep GetPrivateQueuesByMachine(String). Elk van deze twee methoden retourneert een matrix met MessageQueue objecten, die de wachtrijen vertegenwoordigen op het moment dat de methode werd aangeroepen. Aanroepen GetPublicQueuesByCategory(Guid), GetPublicQueuesByLabel(String)of GetPublicQueuesByMachine(String) bieden dezelfde resultaten als aanroepen GetPublicQueues met respectievelijk de filtercriteria van Category, Labelen MachineName, .

In de volgende tabel ziet u of deze methode beschikbaar is in verschillende werkgroepmodi.

Werkgroepmodus Available
Lokale computer No
Naam van lokale computer en directe indeling No
Externe computer No
Naam van externe computer en directe indeling No

Zie ook

Van toepassing op