Sdílet prostřednictvím


Opening Queues Offline

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

The call to open a queue is the same regardless of the offline or online status of the application computer. In both cases, a call to MQOpenQueue or MSMQQueueInfo.Open is used to open local and remote queues.

Opening a queue with receive access while offline

Both local and remote queues can be opened with receive access during offline operation. When you are reading messages in offline mode, you can use either public or direct format names to open local public queues, and you can use either private or direct format names to open local private queues. While offline, you can always use a direct format name to open any local or remote queue with receive access.

However, public queues can be opened with receive access only on computers that were booted with access to the directory service, and were able to query the directory service and cache the properties of these queues. Your application must also obtain and cache the public format names of local public queues or construct their direct format names before opening these queues with receive access.

Opening a queue with send access while offline

Both local and remote queues can be opened with send access. However, to open remote queues while operating offline, the application must first obtain and cache the format names of the queues while operating online or have the information needed to construct direct format names.

Note

When an application operating offline opens a remote queue with send access, all messages that it sends to the queue while offline are stored locally in an outgoing queue. Once the application computer is back online, the messages are passed on to their respective destination queues.

While online, the application can retrieve the format names of public queues from the directory service by calling the MQPathNameToFormatName function or the MSMQQuery.LookupQueue method.

The format names of remote private queues, however, must have been sent from the receiving application while online. The receiving application can use the response queue property (PROPID_M_RESP_QUEUE or MSMQMessage.ResponseQueueInfo) to send the format name of a private queue.

The application must then cache the format names of the remote queues so that it can use them to open the queues later while offline. These format names can be cached in a local private queue, the local registry, or any other application-specific database mechanism.

Format Name Syntax

Queues can be opened using public, private, or direct format names. If the application needs to construct the format name of the queues while offline, the following syntax shows what information is needed to open queues using public, private, and direct format names.

"PUBLIC=QueueGUID"  
"PRIVATE=MachineGUID\QueueNumber"  
DIRECT=AddressSpecification\QueueName (For public queues.)  
DIRECT=AddressSpecification\PRIVATE$\QueueName (For private queues.)  

Note

Specifying a TCP/IP address when you are also using DHCP may generate errors. In this case the target computer may have changed its network address since the last time the application stored the address.

When using a direct format name, the messages are sent directly to the target computer as soon as the application computer is brought back online.

More Information

For information on See
All functions and methods that are restricted when operating offline Offline Quick Reference
Public, private, and direct format names Format Names
Sending messages to remote queues while offline Sending Messages Offline