MessageQueueCriteriaとは? わかりやすく解説

MessageQueueCriteria クラス

MessageQueue クラスの GetPublicQueues メソッドを使用してクエリを実行するときに、メッセージ キューにフィルタをかけます。

名前空間: System.Messaging
アセンブリ: System.Messaging (system.messaging.dll 内)
構文構文

Public Class MessageQueueCriteria
Dim instance As MessageQueueCriteria
public class MessageQueueCriteria
public ref class MessageQueueCriteria
public class MessageQueueCriteria
public class MessageQueueCriteria
解説解説

MessageQueue クラスには、ネットワーク上のパブリック キューの検索結果にフィルタをかける多くのメソッドがあります。キューのラベル、カテゴリ、またはサーバーの場所でフィルタをかけるメソッドは、GetPublicQueuesByLabel、GetPublicQueuesByCategory、および GetPublicQueuesByMachine です。

GetPublicQueues メソッドで MessageQueueCriteria クラスを使用すると、フィルタを詳細に指定できます。GetPublicQueuesBy メソッドのいずれかでは処理できない検索条件や、複数の基準を指定できます。たとえば、キューの作成時刻または変更時刻、キューが存在するコンピュータ、キューのラベルまたはカテゴリ、またはこれらのプロパティの任意の組み合わせで検索するには、MessageQueueCriteria インスタンスを GetPublicQueues メソッドに渡します。

複数のプロパティでフィルタ処理をする場合は、プロパティのセットに AND 演算子を適用することによって、基準が作成されます。そのため、CreatedAfter プロパティと MachineName プロパティに値を指定すると、指定した時刻よりも後に作成された特定のコンピュータに存在するすべてのキューを問い合わせることになります。

プロパティを設定するときに、プロパティを設定するメソッドは、構築するフィルタにそのプロパティを含める必要があることを示すフラグも設定します。検索フィルタから、それぞれのプロパティを削除することはできません。ClearAll を呼び出して、すべてのプロパティをフィルタから削除した後で、検索フィルタに構築するプロパティを設定します。ClearAll は、すべてのプロパティを既定の "設定なし" の状態にリセットします。

読み取る前にプロパティを設定する必要があります。設定しない場合は、例外がスローされます。

使用例使用例

一連のメッセージ キューを反復処理し、1 日前に作成され、"MyComputer" という名前のコンピュータ上に存在するキューのパスを表示する例を次に示します。

Imports System
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 'Main


        
        ' 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 'ListPublicQueuesByCriteria

End Class 'MyNewQueue

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;
        }
    }
}
#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;
}

package MyProject;

import System.*;
import System.Messaging.*;

/// <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(String[]
 args)
    {
        // Create a new instance of the class.
        MyNewQueue myNewQueue = new MyNewQueue();
        // Output the count of Lowest priority messages.
        myNewQueue.ListPublicQueuesByCriteria();
        return;
    } //main

    //**************************************************
    // 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()
    {
        long numberQueues = 0;        
        // Specify the criteria to filter by.
        MessageQueueCriteria myCriteria = new MessageQueueCriteria();
        myCriteria.set_MachineName("MyComputer");
        myCriteria.set_CreatedAfter(DateTime.get_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.get_Current().get_Path());
            numberQueues++;
        }
        // Handle no queues matching the criteria.
        if (numberQueues == 0) {
            Console.WriteLine("No public queues match criteria.");
        }
        return;
    } //ListPublicQueuesByCriteria
} //MyNewQueue
継承階層継承階層
System.Object
  System.Messaging.MessageQueueCriteria
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
MessageQueueCriteria メンバ
System.Messaging 名前空間
GetPublicQueues
GetPublicQueuesByMachine
GetPublicQueuesByLabel
GetPublicQueuesByCategory

MessageQueueCriteria コンストラクタ


MessageQueueCriteria プロパティ


MessageQueueCriteria メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

MessageQueueCriteria クラス
System.Messaging 名前空間
GetPublicQueues
GetPublicQueuesByMachine
GetPublicQueuesByLabel
GetPublicQueuesByCategory

MessageQueueCriteria メンバ

MessageQueue クラスの GetPublicQueues メソッドを使用してクエリを実行するときに、メッセージ キューにフィルタをかけます。

MessageQueueCriteria データ型で公開されるメンバを以下の表に示します。


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド MessageQueueCriteria MessageQueueCriteria クラスの新しいインスタンスを初期化します。
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

MessageQueueCriteria クラス
System.Messaging 名前空間
GetPublicQueues
GetPublicQueuesByMachine
GetPublicQueuesByLabel
GetPublicQueuesByCategory



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「MessageQueueCriteria」の関連用語

MessageQueueCriteriaのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



MessageQueueCriteriaのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS