HOWTO: Program for Queue Location Independence

ID: Q176469

The information in this article applies to:

SUMMARY

This article describes how to handle programming to allow for location independence of a queue. That is, how to allow you to change a queue's host computer.

MORE INFORMATION

MSMQ 1.0 doesn't provide "queue move" functionality. So, an application that wants to move a queue must implement its own move routine. Note that a queue cannot be moved to another computer and retain its identification GUID(PROPID_Q_INSTANCE), because the globally unique identifier (GUID) can neither be specified at create time, nor altered afterward through the MSMQ API or MSMQ Explorer. This poses a problem when attempting to send messages to the new queue, because a message is ultimately addressed with the destination queue's GUID.

For location independence, the application needs to use a property or combination of properties that can be duplicated to uniquely identify the queue. An example of these is the label(PROPID_Q_LABEL), or combination of Type GUID and label(PROPID_Q_LABEL). An application would then use Lookup API to obtain the queue's GUID.

For example, to implement a single mobile queue, you would generate a GUID to identify the queue and assign it as the Type GUID property. To move a queue, the Type GUID would be assigned to the new queue after the old queue was removed. For multiple mobile queues, you could generate and assign a single GUID to the Type GUID property to represent a "mobile type" on all mobile queues. The application could then use unique labels to identify specific queues within the set of mobile queues.

Note that using lookup APIs generates network traffic to the Site Controller. The application should implement caching if it is to be used offline (and to minimize lookup traffic). A forwarding and/or notification mechanism is necessary if the queue will be moved while the application is running offline, or if replication and caching update delays result in misdirected traffic (that is, messages sent to a cached queue GUID need to be returned or forwarded to the appropriate queue GUID).

REFERENCES

http://www.microsoft.com/ntserver/guide/msmq.asp

Keywords          : kbprg MQProg MQQueue MQRouting 
Version           : WINNT:1.0
Platform          : winnt
Issue type        : kbhowto

Last Reviewed: November 11, 1997