MessageQueue.GetMessageQueueEnumerator 메서드

정의

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

오버로드

Name Description
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 네트워크에 있는 모든 공용 메시지 큐의 동적 목록을 제공하는 A입니다.

예제

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

#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합니다.

네트워크에는 정의된 큐 순서가 없습니다. 열거자는 컴퓨터, 레이블, 공용 또는 개인 상태 또는 액세스 가능한 다른 조건에 따라 순서를 지정하지 않습니다.

네트워크에 대한 동적 연결이 아닌 네트워크에 있는 큐의 정적 스냅샷을 원하는 경우 호출 GetPublicQueues 하거나 GetPrivateQueuesByMachine(String). 이러한 두 메서드는 각각 메서드가 호출되었을 때 큐를 나타내는 개체 배열 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 사용 가능한 메시지 큐를 필터링하는 데 사용되는 조건을 포함하는 A입니다.

반품

MessageQueueEnumerator 매개 변수로 지정된 criteria 제한을 충족하는 네트워크의 공용 메시지 큐의 동적 목록을 제공하는 A입니다.

예제

다음 코드 예제에서는 메시지 큐를 반복하고 마지막 날에 만들어졌으며 컴퓨터 "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)를 호출GetPublicQueuesByLabel(String)하거나 GetPublicQueuesByMachine(String) 각각 , GetPublicQueuesCategory의 필터링 조건을 Label사용하여 호출 MachineName 하는 것과 동일한 결과를 제공합니다.

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

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

추가 정보

적용 대상