メッセージの受信またはピークに使用するプロパティ フィルタを取得または設定します。
Public Property MessageReadPropertyFilter As MessagePropertyFilter
[C#]
public MessagePropertyFilter MessageReadPropertyFilter {get; set;}
[C++]
public: __property MessagePropertyFilter* get_MessageReadPropertyFilter();public: __property void set_MessageReadPropertyFilter(MessagePropertyFilter*);
[JScript]
public function get MessageReadPropertyFilter() : MessagePropertyFilter;public function set MessageReadPropertyFilter(MessagePropertyFilter);
プロパティ値
メッセージごとに受信またはピークするプロパティのセットをフィルタ処理するためにキューが使用する MessagePropertyFilter 。
例外
例外の種類 | 条件 |
---|---|
ArgumentException | フィルタが null 参照 (Visual Basic では Nothing) です。 |
解説
このフィルタは、 MessageQueue が受信またはピークするメッセージ プロパティを制限するブール値のセットです。 MessageQueue は、サーバー キューからメッセージを受信またはピークするときに、対応する MessageReadPropertyFilter 値が true であるプロパティだけを取得します。
MessageReadPropertyFilter プロパティのプロパティ初期値を次の表に示します。これらの設定は、 MessagePropertyFilter に対して SetDefaults を呼び出した場合と同一です。
プロパティ | 既定値 |
---|---|
Acknowledgment | false |
AcknowledgeType | false |
AdministrationQueue | true |
AppSpecific | false |
ArrivedTime | true |
AttachSenderId | false |
Authenticated | false |
AuthenticationProviderName | false |
AuthenticationProviderType | false |
Body | true |
ConnectorType | false |
CorrelationId | true |
DefaultBodySize | 1024 バイト |
DefaultExtensionSize | 255 バイト |
DefaultLabelSize | 255 バイト |
DestinationQueue | false |
DestinationSymmetricKey | false |
DigitalSignature | false |
EncryptionAlgorithm | false |
Extension | false |
HashAlgorithm | false |
Id | true |
IsFirstInTransaction | false |
IsLastInTransaction | false |
Label | true |
MessageType | false |
Priority | false |
Recoverable | false |
ResponseQueue | true |
SenderCertificate | false |
SenderId | false |
SenderVersion | false |
SentTime | true |
SourceMachine | false |
TimeToBeReceived | false |
TimeToReachQueue | false |
TransactionId | false |
TransactionStatusQueue | false |
UseAuthentication | false |
UseDeadLetterQueue | false |
UseEncryption | false |
UseJournalQueue | false |
UseTracing | false |
このプロパティが各種のワークグループ モードで使用できるかどうかを次の表に示します。
ワークグループ モード | 使用可否 |
---|---|
ローカル コンピュータ | はい |
ローカル コンピュータ + 直接書式名 | はい |
リモート コンピュータ | はい |
リモート コンピュータ + 直接書式名 | はい |
使用例
[Visual Basic, C#, C++] MessageReadPropertyFilter を使用して、受信するメッセージ プロパティを制限する例を次に示します。
Imports System
Imports 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 retrieves specific groups of Message
' properties.
'**************************************************
Public Shared Sub Main()
' Create a new instance of the class.
Dim myNewQueue As New MyNewQueue()
' Retrieve specific sets of Message properties.
myNewQueue.RetrieveDefaultProperties()
myNewQueue.RetrieveAllProperties()
myNewQueue.RetrieveSelectedProperties()
Return
End Sub 'Main
'**************************************************
' Retrieves the default properties for a Message.
'**************************************************
Public Sub RetrieveDefaultProperties()
' Connect to a message queue.
Dim myQueue As New MessageQueue(".\myQueue")
' Specify to retrieve the default properties only.
myQueue.MessageReadPropertyFilter.SetDefaults()
' Set the formatter for the Message.
myQueue.Formatter = New XmlMessageFormatter(New Type() _
{GetType([String])})
' Receive the first message in the queue.
Dim myMessage As Message = myQueue.Receive()
' Display selected properties.
Console.WriteLine(("Label: " + myMessage.Label))
Console.WriteLine(("Body: " + CType(myMessage.Body, _
[String])))
Return
End Sub 'RetrieveDefaultProperties
'**************************************************
' Retrieves all properties for a Message.
'**************************************************
Public Sub RetrieveAllProperties()
' Connect to a message queue.
Dim myQueue As New MessageQueue(".\myQueue")
' Specify to retrieve all properties.
myQueue.MessageReadPropertyFilter.SetAll()
' Set the formatter for the Message.
myQueue.Formatter = New XmlMessageFormatter(New Type() _
{GetType([String])})
' Receive the first message in the queue.
Dim myMessage As Message = myQueue.Receive()
' Display selected properties.
Console.WriteLine(("Encryption algorithm: " + _
myMessage.EncryptionAlgorithm.ToString()))
Console.WriteLine(("Body: " + CType(myMessage.Body, _
[String])))
Return
End Sub 'RetrieveAllProperties
'**************************************************
' Retrieves application-specific properties for a
' Message.
'**************************************************
Public Sub RetrieveSelectedProperties()
' Connect to a message queue.
Dim myQueue As New MessageQueue(".\myQueue")
' Specify to retrieve selected properties.
Dim myFilter As New MessagePropertyFilter()
myFilter.ClearAll()
' The following list is a random subset of properties.
myFilter.Body = True
myFilter.Label = True
myFilter.MessageType = True
myFilter.Priority = True
myQueue.MessageReadPropertyFilter = myFilter
' Set the formatter for the Message.
myQueue.Formatter = New XmlMessageFormatter(New Type() _
{GetType([String])})
' Receive the first message in the queue.
Dim myMessage As Message = myQueue.Receive()
' Display selected properties.
Console.WriteLine(("Message type: " + _
myMessage.MessageType.ToString()))
Console.WriteLine(("Priority: " + _
myMessage.Priority.ToString()))
Return
End Sub 'RetrieveSelectedProperties
End Class 'MyNewQueue
End Namespace 'MyProject
[C#]
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 retrieves specific groups of Message
// properties.
//**************************************************
public static void Main()
{
// Create a new instance of the class.
MyNewQueue myNewQueue = new MyNewQueue();
// Retrieve specific sets of Message properties.
myNewQueue.RetrieveDefaultProperties();
myNewQueue.RetrieveAllProperties();
myNewQueue.RetrieveSelectedProperties();
return;
}
//**************************************************
// Retrieves the default properties for a Message.
//**************************************************
public void RetrieveDefaultProperties()
{
// Connect to a message queue.
MessageQueue myQueue = new MessageQueue(".\\myQueue");
// Specify to retrieve the default properties only.
myQueue.MessageReadPropertyFilter.SetDefaults();
// Set the formatter for the Message.
myQueue.Formatter = new XmlMessageFormatter(new Type[]
{typeof(String)});
// Receive the first message in the queue.
Message myMessage = myQueue.Receive();
// Display selected properties.
Console.WriteLine("Label: " + myMessage.Label);
Console.WriteLine("Body: " + (String)myMessage.Body);
return;
}
//**************************************************
// Retrieves all properties for a Message.
//**************************************************
public void RetrieveAllProperties()
{
// Connect to a message queue.
MessageQueue myQueue = new MessageQueue(".\\myQueue");
// Specify to retrieve all properties.
myQueue.MessageReadPropertyFilter.SetAll();
// Set the formatter for the Message.
myQueue.Formatter = new XmlMessageFormatter(new Type[]
{typeof(String)});
// Receive the first message in the queue.
Message myMessage = myQueue.Receive();
// Display selected properties.
Console.WriteLine("Encryption algorithm: " +
myMessage.EncryptionAlgorithm.ToString());
Console.WriteLine("Body: " + (String)myMessage.Body);
return;
}
//**************************************************
// Retrieves application-specific properties for a
// Message.
//**************************************************
public void RetrieveSelectedProperties()
{
// Connect to a message queue.
MessageQueue myQueue = new MessageQueue(".\\myQueue");
// Specify to retrieve selected properties.
MessagePropertyFilter myFilter = new
MessagePropertyFilter();
myFilter.ClearAll();
// The following list is a random subset of available properties.
myFilter.Body = true;
myFilter.Label = true;
myFilter.MessageType = true;
myFilter.Priority = true;
myQueue.MessageReadPropertyFilter = myFilter;
// Set the formatter for the Message.
myQueue.Formatter = new XmlMessageFormatter(new Type[]
{typeof(String)});
// Receive the first message in the queue.
Message myMessage = myQueue.Receive();
// Display selected properties.
Console.WriteLine("Message type: " +
myMessage.MessageType.ToString());
Console.WriteLine("Priority: " +
myMessage.Priority.ToString());
return;
}
}
}
[C++]
#using <mscorlib.dll>
#using <system.dll>
#using <system.messaging.dll>
using namespace System;
using namespace System::Messaging;
__gc class MyNewQueue
{
//*************************************************
// Retrieves the default properties for a Message.
//*************************************************
public:
void RetrieveDefaultProperties()
{
// Connect to a message queue.
MessageQueue* myQueue = new MessageQueue(S".\\myQueue");
// Specify to retrieve the default properties only.
myQueue->MessageReadPropertyFilter->SetDefaults();
// Set the formatter for the Message.
Type* p __gc[] = new Type* __gc[1];
p[0] = __typeof(String);
myQueue->Formatter = new XmlMessageFormatter( p );
// Receive the first message in the queue.
Message* myMessage = myQueue->Receive();
// Display selected properties.
Console::WriteLine(S"Label: {0}", myMessage->Label);
Console::WriteLine(S"Body: {0}", static_cast<String*>(myMessage->Body));
return;
}
//*************************************************
// Retrieves all properties for a Message.
//*************************************************
public:
void RetrieveAllProperties()
{
// Connect to a message queue.
MessageQueue* myQueue = new MessageQueue(S".\\myQueue");
// Specify to retrieve all properties.
myQueue->MessageReadPropertyFilter->SetAll();
// Set the formatter for the Message.
Type* p __gc[] = new Type* __gc[1];
p[0] = __typeof(String);
myQueue->Formatter = new XmlMessageFormatter( p );
// Receive the first message in the queue.
Message* myMessage = myQueue->Receive();
// Display selected properties.
Console::WriteLine(S"Encryption algorithm: {0}", __box(myMessage->EncryptionAlgorithm)->ToString());
Console::WriteLine(S"Body: {0}", myMessage->Body);
return;
}
//*************************************************
// Retrieves application-specific properties for a
// Message.
//*************************************************
public:
void RetrieveSelectedProperties()
{
// Connect to a message queue.
MessageQueue* myQueue = new MessageQueue(S".\\myQueue");
// Specify to retrieve selected properties.
MessagePropertyFilter* myFilter = new MessagePropertyFilter();
myFilter->ClearAll();
// The following list is a random subset of available properties.
myFilter->Body = true;
myFilter->Label = true;
myFilter->MessageType = true;
myFilter->Priority = true;
myQueue->MessageReadPropertyFilter = myFilter;
// Set the formatter for the Message.
Type* p __gc[] = new Type* __gc[1];
p[0] = __typeof(String);
myQueue->Formatter = new XmlMessageFormatter( p );
// Receive the first message in the queue.
Message* myMessage = myQueue->Receive();
// Display selected properties.
Console::WriteLine(S"Message type: {0}", __box(myMessage->MessageType)->ToString());
Console::WriteLine(S"Priority: {0}", __box(myMessage->Priority)->ToString());
return;
}
};
//*************************************************
// Provides an entry point into the application.
//
// This example retrieves specific groups of Message
// properties.
//*************************************************
int main()
{
// Create a new instance of the class.
MyNewQueue* myNewQueue = new MyNewQueue();
// Retrieve specific sets of Message properties.
myNewQueue->RetrieveDefaultProperties();
myNewQueue->RetrieveAllProperties();
myNewQueue->RetrieveSelectedProperties();
return 0;
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
.NET Framework セキュリティ:
- 直前の呼び出し元の完全信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細の参照先 : 部分信頼コードからのライブラリの使用
参照
MessageQueue クラス | MessageQueue メンバ | System.Messaging 名前空間 | Peek | Receive | BeginPeek | BeginReceive