다음을 통해 공유


MessageQueue.MessageReadPropertyFilter 속성

정의

메시지를 받거나 또는 피킹하는 데 필요한 속성 필터를 가져오거나 설정합니다.

public:
 property System::Messaging::MessagePropertyFilter ^ MessageReadPropertyFilter { System::Messaging::MessagePropertyFilter ^ get(); void set(System::Messaging::MessagePropertyFilter ^ value); };
[System.ComponentModel.Browsable(false)]
[System.Messaging.MessagingDescription("MQ_MessageReadPropertyFilter")]
public System.Messaging.MessagePropertyFilter MessageReadPropertyFilter { get; set; }
[<System.ComponentModel.Browsable(false)>]
[<System.Messaging.MessagingDescription("MQ_MessageReadPropertyFilter")>]
member this.MessageReadPropertyFilter : System.Messaging.MessagePropertyFilter with get, set
Public Property MessageReadPropertyFilter As MessagePropertyFilter

속성 값

큐가 각각의 메시지에 대해 받거나 피킹하는 속성 집합을 필터링하는 데 사용되는 MessagePropertyFilter입니다.

특성

예외

필터가 null입니다.

예제

다음 코드 예제에서는 를 사용하여 MessageReadPropertyFilter 받은 메시지 속성을 제한합니다.

#using <system.dll>
#using <system.messaging.dll>

using namespace System;
using namespace System::Messaging;
ref class MyNewQueue
{
public:

   //*************************************************
   // Retrieves the default properties for a Message.
   //*************************************************
   void RetrieveDefaultProperties()
   {
      // Connect to a message queue.
      MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" );

      // Specify to retrieve the default properties only.
      myQueue->MessageReadPropertyFilter->SetDefaults();

      // Set the formatter for the Message.
      array<Type^>^p = gcnew array<Type^>(1);
      p[ 0 ] = String::typeid;
      myQueue->Formatter = gcnew XmlMessageFormatter( p );

      // Receive the first message in the queue.
      Message^ myMessage = myQueue->Receive();

      // Display selected properties.
      Console::WriteLine( "Label: {0}", myMessage->Label );
      Console::WriteLine( "Body: {0}", static_cast<String^>(myMessage->Body) );
      return;
   }


   //*************************************************
   // Retrieves all properties for a Message.
   //*************************************************
   void RetrieveAllProperties()
   {
      // Connect to a message queue.
      MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" );

      // Specify to retrieve all properties.
      myQueue->MessageReadPropertyFilter->SetAll();

      // Set the formatter for the Message.
      array<Type^>^p = gcnew array<Type^>(1);
      p[ 0 ] = String::typeid;
      myQueue->Formatter = gcnew XmlMessageFormatter( p );

      // Receive the first message in the queue.
      Message^ myMessage = myQueue->Receive();

      // Display selected properties.
      Console::WriteLine( "Encryption algorithm: {0}", myMessage->EncryptionAlgorithm.ToString() );
      Console::WriteLine( "Body: {0}", myMessage->Body );
      return;
   }

   //*************************************************
   // Retrieves application-specific properties for a
   // Message.
   //*************************************************
   void RetrieveSelectedProperties()
   {
      // Connect to a message queue.
      MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" );

      // Specify to retrieve selected properties.
      MessagePropertyFilter^ myFilter = gcnew 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.
      array<Type^>^p = gcnew array<Type^>(1);
      p[ 0 ] = String::typeid;
      myQueue->Formatter = gcnew XmlMessageFormatter( p );

      // Receive the first message in the queue.
      Message^ myMessage = myQueue->Receive();

      // Display selected properties.
      Console::WriteLine( "Message type: {0}", myMessage->MessageType.ToString() );
      Console::WriteLine( "Priority: {0}", 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 = gcnew MyNewQueue;

   // Retrieve specific sets of Message properties.
   myNewQueue->RetrieveDefaultProperties();
   myNewQueue->RetrieveAllProperties();
   myNewQueue->RetrieveSelectedProperties();
   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 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;
            }
    }
}
Imports System.Messaging

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


        
        ' 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


        
        ' 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


        
        ' 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

End Class

설명

이 필터는 에서 수신하거나 피킹하는 메시지 속성을 MessageQueue 제한하는 부울 값 집합입니다. 는 MessageQueue 서버 큐에서 메시지를 받거나 피킹하면 값true이 인 속성 MessageReadPropertyFilter 만 검색합니다.

다음은 속성의 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

다음 표에서는 이 속성을 다양한 작업 그룹 모드에서 사용할 수 있는지 여부를 보여 줍니다.

작업 그룹 모드 사용 가능
수집 Yes
로컬 컴퓨터 및 직접 형식 이름 Yes
원격 컴퓨터 Yes
원격 컴퓨터 및 직접 형식 이름 Yes

적용 대상

추가 정보