Microsoft KB Archive/176469

= How To Program for Queue Location Independence =

Article ID: 176469

Article Last Modified on 7/2/2004

-

APPLIES TO


 * Microsoft Message Queue Server 1.0

-



This article was previously published under Q176469



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).

Keywords: kbhowto kbprogramming KB176469

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.