MessageQueueCriteria 클래스

정의

쿼리를 수행할 때 MessageQueue 클래스의 GetPublicQueues() 메서드를 사용하여 메시지 큐를 필터링합니다.

public ref class MessageQueueCriteria
public class MessageQueueCriteria
type MessageQueueCriteria = class
Public Class MessageQueueCriteria
상속
MessageQueueCriteria

예제

다음 예제에서는 메시지 큐를 통해 반복 하 고 "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

설명

MessageQueue 클래스는 다양 한 네트워크에 있는 공개 큐에 대 한 검색을 필터링 할 수 있도록 하는 방법 제공 합니다. 큐 레이블, 범주 또는 서버 위치에 따라 필터링 하는 것에 대 한 특정 메서드를 GetPublicQueuesByLabel, GetPublicQueuesByCategory, 및 GetPublicQueuesByMachine합니다.

합니다 MessageQueueCriteria 클래스를 사용 하는 경우는 GetPublicQueues 메서드, 필터를 구체화할 수 있습니다. 중 하나를 통해 명시적으로 주소가 지정 된 검색 조건을 지정할 수는 GetPublicQueuesBy* 메서드 또는 여러 조건을 기준으로 합니다. 전달할 수는 MessageQueueCriteria 인스턴스는 GetPublicQueues 예를 들어, 큐를 만들거나 수정 시간, 큐가 상주 하는 컴퓨터, 큐 레이블은 범주 또는 이러한 속성의 조합을 검색 하기 위해 메서드.

조건을 적용 하 여 구성 된 여러 속성으로 필터링 하는 경우는 AND 속성 집합에는 연산자입니다. 따라서 값을 지정 하는 수를 CreatedAfter 와 함께 속성을 MachineName 속성을 요청 하는 지정 된 시간 이후에 만든 하 고 있는 모든 큐에 대 한 특정 컴퓨터.

모든 속성을 설정 하는 경우 속성을 설정 하는 메서드는 또한를 작성 하는 필터에 포함 시켜야 할 나타내는 플래그를 설정 합니다. 검색 필터에서 개별 속성을 제거할 수 없습니다. 호출 하 여 필터에서 모든 속성을 제거 하는 대신 ClearAll, 검색 필터를 작성 하려는 속성을 설정 합니다. ClearAll 모든 속성을 "설정 안 함" 기본 상태로 다시 설정합니다.

않으면 읽기를 시도 하기 전에 속성을 설정 해야 합니다. 그렇지 않으면 예외가 throw 됩니다.

생성자

MessageQueueCriteria()

MessageQueueCriteria 클래스의 새 인스턴스를 초기화합니다.

속성

Category

네트워크에서 큐를 필터링하는 데 기준이 되는 범주를 가져오거나 설정합니다.

CreatedAfter

네트워크에서 큐를 필터링하는 기준이 되는 큐 작성 날짜 및 시간의 하한을 가져오거나 설정합니다.

CreatedBefore

네트워크에서 큐를 필터링하는 기준이 되는 큐 작성 날짜 및 시간의 상한을 가져오거나 설정합니다.

Label

네트워크에 있는 큐를 필터링하는 데 기준이 되는 레이블을 가져오거나 설정합니다.

MachineName

네트워크에 있는 큐를 필터링하는 데 기준이 되는 컴퓨터 이름을 가져오거나 설정합니다.

ModifiedAfter

네트워크에서 큐를 필터링하는 데 기준이 되는 큐 수정 날짜 및 시간의 하한을 가져오거나 설정합니다.

ModifiedBefore

네트워크에서 큐를 필터링하는 데 기준이 되는 큐 수정 날짜 및 시간의 상한을 가져오거나 설정합니다.

메서드

ClearAll()

필터에 포함된 모든 속성을 지우고 모든 속성 값을 "설정 안 함" 상태로 만듭니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

추가 정보