Aracılığıyla paylaş


MessageQueueCriteria Sınıf

Tanım

Sınıfın MessageQueueGetPublicQueues() yöntemini kullanarak 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 filtrelemek için belirli yöntemler , GetPublicQueuesByCategoryve GetPublicQueuesByMachineşeklindedirGetPublicQueuesByLabel.

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 veya bu özelliklerin herhangi bir bileşimine göre arama yapmak için bir örneği yöntemine geçirebilirsinizMessageQueueCriteria.

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

Herhangi bir özelliği ayarladığınızda, özelliği ayarlayan yöntem de oluşturduğunuz filtreye eklenmesi gerektiğini belirten bir bayrak ayarlar. Arama filtresinden tek tek özellikleri kaldıramazsınız. Bunun yerine, çağırarak ClearAllfiltredeki tüm özellikleri kaldırır ve ardından 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

Name Description
MessageQueueCriteria()

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

Özellikler

Name Description
Category

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

CreatedAfter

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

CreatedBefore

Ağdaki kuyrukların filtreleneceği kuyruk oluşturma tarihi 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ı filtrelemek için kuyruk değiştirme tarihi 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

Name Description
ClearAll()

Tüm özelliklerin bir filtrede yerleşik olmasından temizler ve tüm özellik değerlerini "ayarlanmadı" durumuna getirir.

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()

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

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

Geçerli Objectbasit bir kopyasını oluşturur.

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

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

(Devralındığı yer: Object)

Şunlara uygulanır

Ayrıca bkz.