MessagePropertyFilter Class
TOC
Collapse the table of content
Expand the table of content

MessagePropertyFilter Class

 

Controls and selects the properties that are retrieved when peeking or receiving messages from a message queue.

Namespace:   System.Messaging
Assembly:  System.Messaging (in System.Messaging.dll)

System.Object
  System.Messaging.MessagePropertyFilter

<TypeConverterAttribute(GetType(ExpandableObjectConverter))>
Public Class MessagePropertyFilter
	Implements ICloneable

NameDescription
System_CAPS_pubmethodMessagePropertyFilter()

Initializes a new instance of the MessagePropertyFilter class and sets default values for all properties.

NameDescription
System_CAPS_pubpropertyAcknowledgeType

Gets or sets a value that indicates whether to retrieve Message.AcknowledgeType property information when receiving or peeking a message.

System_CAPS_pubpropertyAcknowledgment

Gets or sets a value that indicates whether to retrieve Message.Acknowledgment property information when receiving or peeking a message.

System_CAPS_pubpropertyAdministrationQueue

Gets or sets a value that indicates whether to retrieve Message.AdministrationQueue property information when receiving or peeking a message.

System_CAPS_pubpropertyAppSpecific

Gets or sets a value that indicates whether to retrieve Message.AppSpecific property information when receiving or peeking a message.

System_CAPS_pubpropertyArrivedTime

Gets or sets a value that indicates whether to retrieve Message.ArrivedTime property information when receiving or peeking a message.

System_CAPS_pubpropertyAttachSenderId

Gets or sets a value that indicates whether to retrieve Message.AttachSenderId property information when receiving or peeking a message.

System_CAPS_pubpropertyAuthenticated

Gets or sets a value that indicates whether to retrieve Message.Authenticated property information when receiving or peeking a message.

System_CAPS_pubpropertyAuthenticationProviderName

Gets or sets a value that indicates whether to retrieve Message.AuthenticationProviderName property information when receiving or peeking a message.

System_CAPS_pubpropertyAuthenticationProviderType

Gets or sets a value that indicates whether to retrieve Message.AuthenticationProviderType property information when receiving or peeking a message.

System_CAPS_pubpropertyBody

Gets or sets a value that indicates whether to retrieve Message.Body property information when receiving or peeking a message.

System_CAPS_pubpropertyConnectorType

Gets or sets a value that indicates whether to retrieve Message.ConnectorType property information when receiving or peeking a message.

System_CAPS_pubpropertyCorrelationId

Gets or sets a value that indicates whether to retrieve Message.CorrelationId property information when receiving or peeking a message.

System_CAPS_pubpropertyDefaultBodySize

Gets or sets the size, in bytes, of the default body buffer.

System_CAPS_pubpropertyDefaultExtensionSize

Gets or sets the size, in bytes, of the default extension buffer.

System_CAPS_pubpropertyDefaultLabelSize

Gets or sets the size, in bytes, of the default label buffer.

System_CAPS_pubpropertyDestinationQueue

Gets or sets a value that indicates whether to retrieve Message.DestinationQueue property information when receiving or peeking a message.

System_CAPS_pubpropertyDestinationSymmetricKey

Gets or sets a value that indicates whether to retrieve Message.DestinationSymmetricKey property information when receiving or peeking a message.

System_CAPS_pubpropertyDigitalSignature

Gets or sets a value that indicates whether to retrieve Message.DigitalSignature property information when receiving or peeking a message.

System_CAPS_pubpropertyEncryptionAlgorithm

Gets or sets a value that indicates whether to retrieve Message.EncryptionAlgorithm property information when receiving or peeking a message.

System_CAPS_pubpropertyExtension

Gets or sets a value that indicates whether to retrieve Message.Extension property information when receiving or peeking a message.

System_CAPS_pubpropertyHashAlgorithm

Gets or sets a value that indicates whether to retrieve Message.HashAlgorithm property information when receiving or peeking a message.

System_CAPS_pubpropertyId

Gets or sets a value that indicates whether to retrieve Message.Id property information when receiving or peeking a message.

System_CAPS_pubpropertyIsFirstInTransaction

Gets or sets a value that indicates whether to retrieve Message.IsFirstInTransaction property information when receiving or peeking a message.

System_CAPS_pubpropertyIsLastInTransaction

Gets or sets a value that indicates whether to retrieve Message.IsLastInTransaction property information when receiving or peeking a message.

System_CAPS_pubpropertyLabel

Gets or sets a value that indicates whether to retrieve Message.Label property information when receiving or peeking a message.

System_CAPS_pubpropertyLookupId

Gets or sets a value that indicates whether to retrieve LookupId property information when receiving or peeking a message.

System_CAPS_pubpropertyMessageType

Gets or sets a value that indicates whether to retrieve Message.MessageType property information when receiving or peeking a message.

System_CAPS_pubpropertyPriority

Gets or sets a value that indicates whether to retrieve Message.Priority property information when receiving or peeking a message.

System_CAPS_pubpropertyRecoverable

Gets or sets a value that indicates whether to retrieve Message.Recoverable property information when receiving or peeking a message.

System_CAPS_pubpropertyResponseQueue

Gets or sets a value that indicates whether to retrieve Message.ResponseQueue property information when receiving or peeking a message.

System_CAPS_pubpropertySenderCertificate

Gets or sets a value that indicates whether to retrieve Message.SenderCertificate property information when receiving or peeking a message.

System_CAPS_pubpropertySenderId

Gets or sets a value that indicates whether to retrieve Message.SenderId property information when receiving or peeking a message.

System_CAPS_pubpropertySenderVersion

Gets or sets a value that indicates whether to retrieve Message.SenderVersion property information when receiving or peeking a message.

System_CAPS_pubpropertySentTime

Gets or sets a value that indicates whether to retrieve Message.SentTime property information when receiving or peeking a message.

System_CAPS_pubpropertySourceMachine

Gets or sets a value that indicates whether to retrieve Message.SourceMachine property information when receiving or peeking a message.

System_CAPS_pubpropertyTimeToBeReceived

Gets or sets a value that indicates whether to retrieve Message.TimeToBeReceived property information when receiving or peeking a message.

System_CAPS_pubpropertyTimeToReachQueue

Gets or sets a value that indicates whether to retrieve Message.TimeToReachQueue property information when receiving or peeking a message.

System_CAPS_pubpropertyTransactionId

Gets or sets a value that indicates whether to retrieve Message.TransactionId property information when receiving or peeking a message.

System_CAPS_pubpropertyTransactionStatusQueue

Gets or sets a value that indicates whether to retrieve Message.TransactionStatusQueue property information when receiving or peeking a message.

System_CAPS_pubpropertyUseAuthentication

Gets or sets a value that indicates whether to retrieve Message.UseAuthentication property information when receiving or peeking a message.

System_CAPS_pubpropertyUseDeadLetterQueue

Gets or sets a value that indicates whether to retrieve Message.UseDeadLetterQueue property information when receiving or peeking a message.

System_CAPS_pubpropertyUseEncryption

Gets or sets a value that indicates whether to retrieve Message.UseEncryption property information when receiving or peeking a message.

System_CAPS_pubpropertyUseJournalQueue

Gets or sets a value that indicates whether to retrieve Message.UseJournalQueue property information when receiving or peeking a message.

System_CAPS_pubpropertyUseTracing

Gets or sets a value that indicates whether to retrieve Message.UseTracing property information when receiving or peeking a message.

NameDescription
System_CAPS_pubmethodClearAll()

Sets all Boolean filter values to false, so that no message properties are retrieved when receiving a message.

System_CAPS_pubmethodClone()

Creates a shallow copy of the object.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodSetAll()

Specifies to retrieve all message properties when receiving a message.

System_CAPS_pubmethodSetDefaults()

Sets the filter values of common Message Queuing properties to true and the integer-valued properties to their default values.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

Setting the MessagePropertyFilter on a MessageQueue instance controls the set of properties that are retrieved when peeking or receiving a message. The filter is set on the instance of MessageQueue that retrieves the message information. When you set a MessagePropertyFilter Boolean-valued member to false, you prevent the information of the associated Message property from being retrieved by the MessageQueue.

There are several filter properties that are not Boolean values. They are integer values that get or set the default sizes of the Message.Body, Message.Extension, or Message.Label.

Retrieving a limited set of properties helps improve performance because smaller amounts of data are transferred from the queue.

When setting a property on MessagePropertyFilter, you are only indicating whether that property is retrieved when a message is received or peeked. You are not changing the associated property value for the Message.

The MessagePropertyFilter constructor sets all filter properties to their default values, which for the Boolean values is false. See the constructor topic for the defaults assigned to the integer-valued properties.

The following code example sends two messages of different priorities to the queue, and retrieves them subsequently.

Imports System
Imports System.Messaging


'Provides a container class for the example.
Public Class MyNewQueue



      ' Provides an entry point into the application.
      '		 
      ' This example sends and receives a message from
      ' a queue.

      Public Shared Sub Main()
         ' Create a new instance of the class.
         Dim myNewQueue As New MyNewQueue()

         ' Send messages to a queue.
         myNewQueue.SendMessage(MessagePriority.Normal, "First Message Body.")
         myNewQueue.SendMessage(MessagePriority.Highest, "Second Message Body.")

         ' Receive messages from a queue.
         myNewQueue.ReceiveMessage()
         myNewQueue.ReceiveMessage()

         Return
      End Sub 'Main




      ' Sends a string message to a queue.

      Public Sub SendMessage(priority As MessagePriority, messageBody As String)

         ' Connect to a queue on the local computer.
         Dim myQueue As New MessageQueue(".\myQueue")

         ' Create a new message.
         Dim myMessage As New Message()

         If priority > MessagePriority.Normal Then
            myMessage.Body = "High Priority: " + messageBody
         Else
            myMessage.Body = messageBody
         End If 
         ' Set the priority of the message.
         myMessage.Priority = priority


         ' Send the Order to the queue.
         myQueue.Send(myMessage)

         Return
      End Sub 'SendMessage




      ' Receives a message.

      Public Sub ReceiveMessage()
         ' Connect to the a queue on the local computer.
         Dim myQueue As New MessageQueue(".\myQueue")

         ' Set the queue to read the priority. By default, it
         ' is not read.
         myQueue.MessageReadPropertyFilter.Priority = True

         ' Set the formatter to indicate body contains a string.
         myQueue.Formatter = New XmlMessageFormatter(New Type() {GetType(String)})

         Try
            ' Receive and format the message. 
            Dim myMessage As Message = myQueue.Receive()

            ' Display message information.
            Console.WriteLine(("Priority: " + myMessage.Priority.ToString()))
            Console.WriteLine(("Body: " + myMessage.Body.ToString()))



         ' Handle invalid serialization format.
         Catch e As InvalidOperationException
            Console.WriteLine(e.Message)
         End Try

         ' Catch other exceptions as necessary.
         Return
      End Sub 'ReceiveMessage
   End Class 'MyNewQueue

.NET Framework
Available since 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft