MessageQueue.GetMessageQueueEnumerator 메서드

정의

네트워크에 있는 공개 큐의 동적 목록에 대한 열거자 개체를 만듭니다.

오버로드

GetMessageQueueEnumerator()

앞으로만 이동 가능한 커서 의미 체계 기능을 제공하여 네트워크에 있는 모든 공개 큐를 열거합니다.

GetMessageQueueEnumerator(MessageQueueCriteria)

앞으로만 이동 가능한 커서 의미 체계 기능 제공하여 네트워크에 있는 공개 큐 중 지정된 기준을 만족하는 큐를 모두 열거합니다.

GetMessageQueueEnumerator()

앞으로만 이동 가능한 커서 의미 체계 기능을 제공하여 네트워크에 있는 모든 공개 큐를 열거합니다.

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

반환

네트워크에 있는 모든 공개 메시지 큐의 동적 목록을 제공하는 MessageQueueEnumerator입니다.

예제

다음 코드 예제에서는 네트워크의 모든 메시지 큐를 통해 반복 하 고 각 큐에 대 한 경로 검사 합니다. 마지막으로 네트워크에서 공개 큐의 수를 표시합니다.

#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

설명

이 오버로드는 GetMessageQueueEnumerator 네트워크에 있는 모든 공용 큐의 열거형을 반환합니다.

커서는 동적 목록과 연결되므로 열거형은 커서의 현재 위치 이상으로 삭제되거나 추가된 큐에 대한 큐 목록에 대한 모든 수정 내용을 반영합니다. 커서의 현재 위치 앞에 있는 큐의 추가 또는 삭제는 반영되지 않습니다. 예를 들어 열거자는 커서 위치 외에 추가된 큐에 자동으로 액세스할 수 있지만 해당 위치 앞에 삽입된 큐는 액세스할 수 없습니다. 그러나 를 호출 ResetMessageQueueEnumerator하여 열거형을 다시 설정하여 커서를 목록의 시작 부분으로 다시 이동할 수 있습니다.

네트워크에서 큐의 정의 된 순서가 있지 않습니다. 열거자는 컴퓨터, 레이블, 퍼블릭 또는 프라이빗 상태 또는 기타 액세스 가능한 기준에 따라 순서를 지정하지 않습니다.

동적 연결이 아닌 네트워크에 있는 큐의 정적 스냅샷을 원하는 경우 또는 GetPrivateQueuesByMachine(String)를 호출 GetPublicQueues 합니다. 이러한 두 메서드 각각은 메서드가 호출되었을 때의 큐를 나타내는 개체 배열 MessageQueue 을 반환합니다.

다음 표에서는 이 메서드를 다양한 작업 그룹 모드에서 사용할 수 있는지 여부를 보여 줍니다.

작업 그룹 모드 사용 가능
수집 No
로컬 컴퓨터 및 직접 형식 이름 No
원격 컴퓨터 No
원격 컴퓨터 및 직접 형식 이름 No

추가 정보

적용 대상

GetMessageQueueEnumerator(MessageQueueCriteria)

앞으로만 이동 가능한 커서 의미 체계 기능 제공하여 네트워크에 있는 공개 큐 중 지정된 기준을 만족하는 큐를 모두 열거합니다.

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

매개 변수

criteria
MessageQueueCriteria

사용 가능한 메시지 큐를 필터링하는 데 사용되는 기준이 포함된 MessageQueueCriteria입니다.

반환

네트워크에 있는 공개 메시지 큐 중 criteria 매개 변수가 지정한 제한 사항을 만족시키는 큐에 대한 동적 목록을 제공하는 MessageQueueEnumerator입니다.

예제

다음 코드 예제에서는 메시지 큐를 반복하고 마지막 날에 만들어졌으며 컴퓨터 "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

설명

이 오버 로드 GetMessageQueueEnumerator 애플리케이션 조건에 정의 된 조건을 충족 하는 네트워크에 있는 모든 공개 큐의 목록을 반환 합니다. 큐 만들기 또는 수정 시간, 컴퓨터 이름, 레이블, 범주 또는 이러한 조합과 같이 포함할 조건을 지정할 수 있습니다.

커서가 동적 목록과 연결되어 있으므로 열거형은 커서의 현재 위치를 벗어나는 큐에 대한 모든 수정 내용을 반영합니다. 커서의 현재 위치 앞에 있는 큐에 대한 변경 내용은 반영되지 않습니다. 예를 들어 열거자는 커서 위치 외에 추가된 큐에 자동으로 액세스할 수 있지만 해당 위치 앞에 삽입된 큐는 액세스할 수 없습니다. 그러나 를 호출 ResetMessageQueueEnumerator하여 열거형을 다시 설정하여 커서를 목록의 시작 부분으로 다시 이동할 수 있습니다.

네트워크에서 큐의 정의 된 순서가 있지 않습니다. 열거자는 컴퓨터, 레이블, 퍼블릭 또는 프라이빗 상태 또는 기타 액세스 가능한 기준에 따라 순서를 지정하지 않습니다.

동적 연결이 아닌 네트워크에 있는 큐의 정적 스냅샷을 원하는 경우 에 대한 GetPublicQueues 조건을 지정하거나 를 호출 GetPrivateQueuesByMachine(String)합니다. 이러한 두 메서드 각각은 메서드가 호출되었을 때의 큐를 나타내는 개체 배열 MessageQueue 을 반환합니다. , 또는 를 호출GetPublicQueuesByCategory(Guid)하면 각각 , Label및 의 Category필터링 조건을 사용하여 를 호출 GetPublicQueues 하는 것과 MachineName동일한 결과를 GetPublicQueuesByMachine(String) 제공합니다. GetPublicQueuesByLabel(String)

다음 표에서는 이 메서드를 다양한 작업 그룹 모드에서 사용할 수 있는지 여부를 보여 줍니다.

작업 그룹 모드 사용 가능
수집 No
로컬 컴퓨터 및 직접 형식 이름 No
원격 컴퓨터 No
원격 컴퓨터 및 직접 형식 이름 No

추가 정보

적용 대상