Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MessageQueue.Exists() fails for remote queues

1,053 views
Skip to first unread message

Arrakktur

unread,
Jul 30, 2008, 10:15:00 AM7/30/08
to
Hello, gentlemen.

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

Frank Boyne

unread,
Jul 30, 2008, 3:31:25 PM7/30/08
to
"Arrakktur" <Arra...@discussions.microsoft.com> wrote in message
news:E3D62138-D9D4-4AEA...@microsoft.com...

> But when I try to
> check if queue exists I get InvalidOperationException from
> MessageQueue.Exists() method.

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.


Arrakktur

unread,
Jul 31, 2008, 2:14:01 AM7/31/08
to
Thank you Frank. It was really helpful.

Sorry if my question was too dummy :)

0 new messages