다음을 통해 공유


Default Message Properties 

When you create an instance of the MessageQueue component, you have the option of setting a series of default properties that 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.

NoteNote

Only messages that are not sent using the Message object use the DefaultPropertiesToSend values. When you send a message using the Message object, the properties of the Message object are used.

You set default message properties by setting values in the DefaultPropertiesToSend section of the Properties window, or by setting values for the properties in the DefaultPropertiesToSend object. These default properties control features such as whether acknowledgement messages are generated and where they are sent, how your messages are encrypted and authenticated, and the time-out period for your messages.

This page provides an overview of how you might set some of the more critical properties in this area.

Message Priority

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.

NoteNote

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.

Acknowledgement and Response Properties

There are several default properties you can set that determine whether responses and acknowledgements 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:

  • The AcknowledgeType and AdministrationQueue properties. You can use these properties to determine whether acknowledgement messages should be generated when your messages reach or fail to reach their destination queue, or when the messages are retrieved from the queue by the target application. For more information, see How to: Request Acknowledgement for Messages.

  • The ResponseQueue property, which you can use to indicate the return path for any messages that will be sent by the application retrieving your messages from the queue. These messages differ from acknowledgement messages in that they are generated by the destination application, rather than by the queue manager.

  • The UseJournalQueue property, which you can use to determine whether copies of your outgoing messages should be stored in a journal queue. Similarly, you can determine whether undeliverable messages should be sent to a dead-letter queue by setting the UseDeadLetterQueue property.

Time-Out Properties

There are two time-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:

  • If you set the UseDeadLetterQueue property to true, a copy of the discarded message will be sent to the specified dead-letter queue.

  • If you set the AcknowledgeType property to send negative acknowledgements, an acknowledgement message will be sent to the specified Administration queue.

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.

See Also

Tasks

How to: Create MessageQueue Component Instances

Other Resources

Sending and Serializing Messages