MessageQueueCriteria Sınıf

Tanım

Sınıfın GetPublicQueues() yöntemini kullanarak MessageQueue sorgu gerçekleştirirken ileti kuyruklarını filtreler.

public ref class MessageQueueCriteria
public class MessageQueueCriteria
type MessageQueueCriteria = class
Public Class MessageQueueCriteria
Devralma
MessageQueueCriteria

Örnekler

Aşağıdaki örnek, ileti kuyruklarında yinelenir ve son gün içinde oluşturulan ve "Bilgisayarım" bilgisayarında bulunan her kuyruğun yolunu görüntüler.

#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

Açıklamalar

sınıfı, MessageQueue ağdaki genel kuyruklar için aramanızı filtrelemenizi sağlayan bir dizi yöntem sağlar. Kuyruk etiketine, kategoriye veya sunucu konumuna göre filtrelemeye yönelik belirli yöntemler , GetPublicQueuesByCategoryve GetPublicQueuesByMachine'tirGetPublicQueuesByLabel.

MessageQueueCriteria yöntemiyle GetPublicQueues kullanıldığında sınıfı, filtrenizi daraltmanıza olanak tanır. * yöntemlerinden biriyle GetPublicQueuesByveya birden çok ölçütle özel olarak ele alınmayan arama ölçütlerini belirtebilirsiniz. Örneğin kuyruk oluşturma veya değiştirme zamanlarına, kuyruğun GetPublicQueues bulunduğu bilgisayara, kuyruk etiketine veya kategorisine ya da bu özelliklerin herhangi bir bileşimine göre arama yapmak için yöntemine bir MessageQueueCriteria örnek geçirebilirsiniz.

Birden çok özelliğe göre filtreleme yaparken, ölçütler işleci özellik kümesine uygulanarak AND oluşturulur. Bu nedenle, özelliği için CreatedAfter özelliğiyle birlikte bir değer belirttiğinizde MachineName , belirli bir süreden sonra oluşturulan ve belirli bir bilgisayarda bulunan tüm kuyrukları sorarsınız.

Herhangi bir özelliği ayarladığınızda, özelliği ayarlayan yöntemi de oluşturduğunuz filtreye dahil edilmesi gerektiğini belirtmek için bir bayrak ayarlar. Arama filtresinden tek tek özellikleri kaldıramazsınız. Bunun yerine, çağırarak ClearAllfiltreden tüm özellikleri kaldırır ve sonra arama filtresine oluşturmak istediğiniz özellikleri ayarlarsınız. ClearAll tüm özellikleri "ayarlanmadı" varsayılan durumuna sıfırlar.

Bir özelliği okumaya çalışmadan önce ayarlamanız gerekir; aksi takdirde, bir özel durum oluşturulur.

Oluşturucular

MessageQueueCriteria()

MessageQueueCriteria sınıfının yeni bir örneğini başlatır.

Özellikler

Category

Ağdaki kuyrukların filtreleneceği kategoriyi alır veya ayarlar.

CreatedAfter

Ağdaki kuyrukların filtreleneceği kuyruk oluşturma tarih ve saatinin alt sınırını alır veya ayarlar.

CreatedBefore

Ağdaki kuyrukların filtreleneceği kuyruk oluşturma tarih ve saatinin üst sınırını alır veya ayarlar.

Label

Ağdaki kuyrukların filtreleneceği etiketi alır veya ayarlar.

MachineName

Ağdaki kuyrukların filtreleneceği bilgisayar adını alır veya ayarlar.

ModifiedAfter

Ağdaki kuyrukların filtreleneceği kuyruk değiştirme tarih ve saatinin alt sınırını alır veya ayarlar.

ModifiedBefore

Ağdaki kuyrukların filtreleneceği kuyruk değiştirme tarihi ve saatinin üst sınırını alır veya ayarlar.

Yöntemler

ClearAll()

Bir filtrede yerleşik olan tüm özellikleri temizler ve tüm özellik değerlerini "ayarlanmadı" durumuna geçirir.

Equals(Object)

Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.

(Devralındığı yer: Object)
GetHashCode()

Varsayılan karma işlevi işlevi görür.

(Devralındığı yer: Object)
GetType()

Type Geçerli örneğini alır.

(Devralındığı yer: Object)
MemberwiseClone()

Geçerli Objectöğesinin sığ bir kopyasını oluşturur.

(Devralındığı yer: Object)
ToString()

Geçerli nesneyi temsil eden dizeyi döndürür.

(Devralındığı yer: Object)

Şunlara uygulanır

Ayrıca bkz.