ID: Q172688
The information in this article applies to:
You may want to write a Microsoft Message Queue Server (MSMQ) application for a single computer to generate and queue messages while offline and then, when later connected to the network, forward the messages to a remote application or notify the remote application that the local queue of messages is now available for it to open and read.
IMPORTANT: When writing an offline application using local queues, define the queues to be Recoverable. Using Express queues may lead to loss of messages.
The configuration targeted for individual offline operation is the Independent Client. The Dependent Client is incapable of operating offline. The Windows NT Server and SQL Server requirements of a Site controller configuration, while simpler to code for, would probably be impractical for a single offline user.
When the offline computer is an Independent client, you need to write the offline portion of the application carefully to avoid using APIs that query the Message Queue Server Information Store (MQIS). The MQIS is held only on site controllers (PEC/PSC/BSC). Using any API, like MQLocate, that requires consultation of the MQIS would attempt to generate network traffic, causing an error or timeout in the application.
To open a handle to a queue with no connection to a Falcon MQIS server you can do either of the following:
-or-
This format includes the target computer's name, or the target computer's network address, and local queue name of the target queue. This method can only be used when the target computer is directly connectable (one MSMQ hop) from the source computer.
Falcon routing will not take place with such addressing. The message is sent directly to the remote computer's queue as soon as the sending client regains connectivity with the remote computer. No access to the MQIS is required.
To specify the format name, you can do either of the following:
-or-
This format requires your application to cache this GUID before disconnecting. The MQOpenQueue() will succeed offline, and then you can send messages, and close the queue handle, and quit the application. All messages will be stored by the QM for the application.
A connection to the MQIS server is eventually required using this method. To actually transfer messages to the remote destination queue , MSMQ needs to consult an MQIS server in order to resolve the GUID into a network address. If the MQIS server is down when the sending computer regains connectivity, the sending computer will not send the messages.
Private Sub OpenQueueOffline()
Dim qinfo As MSMQQueueInfo
Set qinfo = New MSMQQueueInfo
Dim q As New MSMQQueue
txtDirectFormatName = "DIRECT=TCP:157.57.12.62\wiley"
qinfo.strPathName = ""
qinfo.strFormatName = ""
qinfo.strLabel = ""
qinfo.strFormatName = txtDirectFormatName
on error goto ErrorHandler
Set q = qinfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE)
If q.isOpen Then
MsgBox "The queue " + qinfo.strPathName + " is open."
Else
MsgBox "The queue " + qinfo.strPathName + " is not open!"
End If
'Clean up
qinfo.strPathName = ""
Set qinfo = Nothing
Set q = Nothing
Exit Function
ErrorHandler:
msgbox "error while opening queue: " qinfo.strPathName
Exit Function
End Sub
For more information, please see the MSMQ Offline Support section of the MSMQ software development kit (SDK).
Additional query words: app machine
Keywords : kbprg MQAPI MQProg MQQueue
Version : WinNT:1.0
Platform : winnt
Issue type : kbhowto kbinfo
Last Reviewed: September 17, 1997