I have a remote server with Windows Server 2003 and MSMQ 3.0 installed.
Remote server is visible and doesn't use ActiveDirectory. All I need is to
connect to private queue on that server and send a message. But when I try to
check if queue exists I get InvalidOperationException from
MessageQueue.Exists() method.
I've tried to use different path strings with no luck:
string remotePath = "FormatName:Direct=HTTP://1.2.3.4/private$/testqueue"
string remotePath = @"FormatName:DIRECT=TCP:1.2.3.4\private$\testqueue"
strign remotePath = @"FormatName:DIRECT=OS:ServerName\private$\testqueue"
Still I can get needed queue via MessageQueue.GetPrivateQueuesByMachine()
method, it's not operable, because most of its properties throw
MessageQueueException.
Please help me to solve this issue.
Thanks, Andrew
I'm afraid you can't do what you are trying to do.
Look at the documentation for the Exists function. Towards the end of
the Remarks section is a table that indicates whether the method is
available for various Wrokgroup modes. Exists is not supported for
Remote computers.
http://msdn.microsoft.com/en-us/library/system.messaging.messagequeue.exists.aspx
> Please help me to solve this issue.
Typically, you wouldn't check to see if a queue exists before sending a
message to it. Even if it existed when you checked, it might get
deleted before your message arrived. Likewise, even if it didn;t exist
when you checked, it might exist by the time your message arrived.
The usual MSMQ way to deal with this kind of thing is to use Time To
Reach Queue to place an upper limit on how long you are willing to wait
for the message to reach the queue in question and then use
Acknowledgement and the Admin queue to get a negative acknowledgement if
the message does not reach the queue.
In other words, you don;t check if the queue exists, you handle the
non-delivery if it turns out that the queue didn't exist.
That's not the only possible approach, you can also use Journalling and
look in the Dead Letter Queue for undeliverable messages.
Sorry if my question was too dummy :)