Share via


How to: Specify Properties to Retrieve with a MessageĀ 

When you create an instance of the MessageQueue component, you can set a series of properties to indicate what properties you want to retrieve when the component gets a message from a queue. These properties exist in a class called MessagePropertyFilter and correspond to actual properties on the Message class. When you set the value for one of these properties to true, the component will retrieve the corresponding property each time a message is removed from the queue.

NoteTip

If you do not need access to some properties in your retrieved message and want to improve performance, you can set the MessagePropertyFilter to false.

By default, the properties retrieved with a message include properties indicating the time it was sent and arrived, several identifiers for the message, the message's label, the response queue, and the body of the message.

To specify the properties to retrieve with a message

  1. Create an instance of the MessageQueue component and set its Path property to the queue to which you want to refer. For more information, see How to: Create MessageQueue Component Instances.

  2. In the Properties window, expand the MessageReadPropertyFilter node.

  3. Set the value for the properties you want to receive to true.

    NoteNote

    You can set these in code, as well. When doing so, you can use the SetAll method to set all the filter properties to true, or the ClearAll method to set all the filter properties to false.

See Also

Tasks

How to: Receive Messages Programmatically
How to: Peek at Messages
How to: Receive Messages Asynchronously
How to: Create MessageQueue Component Instances

Other Resources

Reading and Receiving Messages