We have a problem with MSMQ. This is a short description of the problem.
Opening a non-existing queue on an existing machine does not generate any
errors. It seems like the message has been sent without errors. How do I
detect that a queue on a remote machine does not exist? We are sending the
messages to private queues on remote machines. If the machine does not exist
the message is stored in the outgoing queue, but not when the message is
sent to an non-existing queue on an existing machine.
Our code looks like this.
Dim mqSendQueue As MSMQQueue
Dim mqiSendQueueInfo As MSMQQueueInfo
Dim mqmSendMessage As MSMQMessage
Set mqiSendQueueInfo = New MSMQQueueInfo
mqiSendQueueInfo.FormatName = "DIRECT=OS:" & xmlMessage.ToMachine &
"\PRIVATE$\" & xmlMessage.ToQueue
Set mqmSendMessage = New MSMQMessage
mqmSendMessage.Priority =
CLng(xmlMessage.GetElementValue("/HEADER/MSG_PRIORITY"))
mqmSendMessage.Label = xmlMessage.MessageType
mqmSendMessage.Body = xmlMessage.XMLString
mqmSendMessage.Delivery = MQMSG_DELIVERY_RECOVERABLE
Set mqSendQueue = New MSMQQueue
Set mqSendQueue = mqiSendQueueInfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE)
mqmSendMessage.Send mqSendQueue
Regards,
Jarno
"Jarno Nieminen" <jarno.n...@askus.se> wrote in message
news:#zf4qmfBBHA.1304@tkmsftngp02...
Remember, MSMQ is designed to work even when the destination system, or the
sending system is disconnected from the network. Thus it cannot really
assume that it can check for a queue's existence.
> It seems like the message has been sent without errors.
To "send" a message without errors, you only have to interact with the local
Queue Manager. Once the local QM has returned S_OK, it has taken
responsibility for delivering the message to the destination (or at least
attempting to). Many things can prevent a local QM from delivering a
message successfully. For example, the destination queue's Permissions may
not allow the sender to place a message in the queue. Or the queue may have
been destroyed since the message was originally sent.
> How do I detect that a queue on a remote machine does not exist?
You don't (especially since that isn't the only problem that might prevent
delivery). Instead you use the MSMQ acknowledgement capability to determine
whether or not the message made it. You can ask for negative
acknowledgement which only tells you if a message failed to be delivered, or
you can use full acknowldgement and also get notification that the message
was delivered successfully.
You can also set the Time to Reach Queue, or Time To Receive limits so that
the message times out (and generates a negative acknowledgement) if the
message just gets stuck for too long at some intermediate node, or gets
stuck in the queue for too long without being received by something.
For more info, see the Platform SDK
http://msdn.microsoft.com/library/en-us/msmq/hh/msmq/msmq_about_messages_76w
j.asp