When you create an instance of the MessageQueue component, you have the option of setting a series of default properties that all messages sent by that component will use. This allows you to save time when defining your messages, and to have more control over the Send method without the need to create and configure Message objects.
You set default message properties by setting values in the DefaultPropertiestoSend section of the Properties window. These default properties control features such as whether acknowledgment messages are generated and where they are sent, how your messages are encrypted and authenticated, the message priority, and the time-out period for your messages.
This topic provides an overview of how you might set some of the more critical properties in this area. For a full description of the default properties, see DefaultPropertiesToSend Members.
Setting a default priority for your messages affects the order in which they are sent to their destination queues. You set the Priority property to determine the default priority for messages sent by your component. Priority ratings default to normal, with settings for lower and higher priorities.
The priority setting for a message determines where the message is placed in the queue. Messages sent with a higher priority are placed higher in the queue, and messages with a lower priority are placed lower in the queue. When the queue receives a set of messages with an identical priority setting, the messages are arranged in the queue according to the time when they were sent.
Note You cannot set priority on messages that are being sent to transactional queues, because the order in which messages are processed on a transactional queues are determined by the transaction itself.
There are several default properties you can set that determine whether responses and acknowledgments will be generated for your component’s messages and how these responses will be handled. The properties you can set as a default for all messaging operations include:
There are two timer-related properties you can use to help maintain better control of your messages. Both of these determine how long a message can exist in the system before it is discarded. You use the TimeToReachQueue property to specify how long a message has to try to reach its destination queue. You use the TimeToBeReceived property to specify how long the message should remain in the system, from the time it is sent until the time it is removed from the queue by the destination application. If either timer interval expires, Message Queuing discards the message.
When a message is discarded due to an expired timer, the queue manager might take additional steps:
By default, no time-out interval is set for either property. If you set a value for both properties, the value in the TimeToBeReceived property takes precedence.
Sending and Serializing Messages | Creating MessageQueue Components