Udostępnij za pośrednictwem


How to: Send Messages to Disconnected Queues

There are two situations in which messages cannot readily be delivered to their queues: when the computer on which the queue resides is not available, or when the domain controller needed to route your message is not available. Message Queuing allows you to handle these situations so that if you are disconnected from the network or a necessary computer or controller is not available, you can continue to send messages. In these cases, the messages are temporarily stored on a queue on the local computer or a computer along the delivery route until the necessary resources are back online for delivery to be completed.

For example, suppose you have a central queue that records orders sent by your on-the-road sales force. The sales force works in disconnected mode much of the day, recording order information from customer sites, and dials in once a day to transfer all of this information to the central queue. Because messages can be sent to queues when the sender is disconnected, the sales force can send their messages immediately upon recording the customer's information; the system caches those messages until the nightly call is placed.

Sending a message to a disconnected queue is almost identical to the process of sending a message to an available queue. You do not have to perform any special configuration in order for your component to store messages in a temporary queue when the queue to which you are sending is not available. There are two main differences to be aware of:

  • If the queue is unavailable but the domain controller is working, you must identify the queue you want to send to by the queue's format name, rather than the path name. When a queue is disconnected, the domain controller for the queue cannot resolve the path name correctly. For more information on format names, see Queue Reference Recommendations.

  • If you set a time-out interval on your message-send operation, the time-out period will begin to count down as soon as the message is sent. This means that while the message sits on your local computer waiting for the queue to become available, the time-out period is active and the expiration time is approaching. If you want to use the time-out period, you must either set it to a large enough interval to allow for delivery or request negative acknowledgement for the message so that you know if expiration has occurred. For more information on requesting acknowledgement when a message cannot be delivered, see How to: Request Acknowledgement for Messages.

To send a message to a disconnected queue

  1. Create an instance of the MessageQueue component. For more information, see How to: Create MessageQueue Component Instances.

  2. Set the Path property for the component to the format name of the queue to which you want to send a message.

    Note

    If you create the component from Server Explorer, this property will automatically refer to the path instead of the format name. To change to the format name, click the expansion icon next to the Path property. In the dialog box that appears, locate and select the queue your component references; then select Format Name in the Reference Queue By field and click OK.

  3. Send your message normally.

See Also

Tasks

How to: Request Acknowledgement for Messages

How to: Send Simple Messages

How to: Send Complex Messages

How to: Create MessageQueue Component Instances

How to: Verify Messages at Design Time

Concepts

Default Message Properties

Other Resources

Sending and Serializing Messages