MessageQueueCriteria クラス
アセンブリ: System.Messaging (system.messaging.dll 内)


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.Messaging.MessageQueueCriteria


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


MessageQueueCriteria メンバ
System.Messaging 名前空間
GetPublicQueues
GetPublicQueuesByMachine
GetPublicQueuesByLabel
GetPublicQueuesByCategory
MessageQueueCriteria コンストラクタ
アセンブリ: System.Messaging (system.messaging.dll 内)



Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


MessageQueueCriteria プロパティ

名前 | 説明 | |
---|---|---|
![]() | Category | ネットワーク上のキューにフィルタをかけるカテゴリを取得または設定します。 |
![]() | CreatedAfter | ネットワーク上のキューにフィルタをかけるキューの作成日時の下限を取得または設定します。 |
![]() | CreatedBefore | ネットワーク上のキューにフィルタをかけるキューの作成日時の上限を取得または設定します。 |
![]() | Label | ネットワーク上のキューにフィルタをかけるラベルを取得または設定します。 |
![]() | MachineName | ネットワーク上のキューにフィルタをかけるコンピュータ名を取得または設定します。 |
![]() | ModifiedAfter | ネットワーク上のキューにフィルタをかけるキューの変更日時の下限を取得または設定します。 |
![]() | ModifiedBefore | ネットワーク上のキューにフィルタをかけるキューの変更日時の上限を取得または設定します。 |

関連項目
MessageQueueCriteria クラスSystem.Messaging 名前空間
GetPublicQueues
GetPublicQueuesByMachine
GetPublicQueuesByLabel
GetPublicQueuesByCategory
MessageQueueCriteria メソッド

名前 | 説明 | |
---|---|---|
![]() | ClearAll | すべてのプロパティをフィルタへの構築対象から削除し、すべてのプロパティ値を "設定なし" の状態にします。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

関連項目
MessageQueueCriteria クラスSystem.Messaging 名前空間
GetPublicQueues
GetPublicQueuesByMachine
GetPublicQueuesByLabel
GetPublicQueuesByCategory
MessageQueueCriteria メンバ
MessageQueue クラスの GetPublicQueues メソッドを使用してクエリを実行するときに、メッセージ キューにフィルタをかけます。
MessageQueueCriteria データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | Category | ネットワーク上のキューにフィルタをかけるカテゴリを取得または設定します。 |
![]() | CreatedAfter | ネットワーク上のキューにフィルタをかけるキューの作成日時の下限を取得または設定します。 |
![]() | CreatedBefore | ネットワーク上のキューにフィルタをかけるキューの作成日時の上限を取得または設定します。 |
![]() | Label | ネットワーク上のキューにフィルタをかけるラベルを取得または設定します。 |
![]() | MachineName | ネットワーク上のキューにフィルタをかけるコンピュータ名を取得または設定します。 |
![]() | ModifiedAfter | ネットワーク上のキューにフィルタをかけるキューの変更日時の下限を取得または設定します。 |
![]() | ModifiedBefore | ネットワーク上のキューにフィルタをかけるキューの変更日時の上限を取得または設定します。 |

名前 | 説明 | |
---|---|---|
![]() | ClearAll | すべてのプロパティをフィルタへの構築対象から削除し、すべてのプロパティ値を "設定なし" の状態にします。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

関連項目
MessageQueueCriteria クラスSystem.Messaging 名前空間
GetPublicQueues
GetPublicQueuesByMachine
GetPublicQueuesByLabel
GetPublicQueuesByCategory
- MessageQueueCriteriaのページへのリンク