MessageQueue with unstable network connections

  • Thread starter Thread starter Alexander Oldemeier
  • Start date Start date
A

Alexander Oldemeier

Hi there. Does anyone have an idea how to manage a MessageQueue used to
receive messages asynchronously from a remote computer in an environment
where the network connection may be down sometimes?
The problem I experienced was that the MessageQueue object seems to be
nonfunctional even after the network connection is back again. When I try to
dispose and recreate the MessageQueue object when the connection is back it
still does not work (EndReceive raises an exception) - so after the
connection is down one time, I have no chance to read from the same queue
until I restart the application. I use C# with VS.NET 2003. Thanks for any
hints
Alex
 
Alexander Oldemeier said:
Hi there. Does anyone have an idea how to manage a MessageQueue used to
receive messages asynchronously from a remote computer in an environment
where the network connection may be down sometimes?
The problem I experienced was that the MessageQueue object seems to be
nonfunctional even after the network connection is back again. When I try
to dispose and recreate the MessageQueue object when the connection is
back it still does not work (EndReceive raises an exception) - so after
the connection is down one time, I have no chance to read from the same
queue until I restart the application. I use C# with VS.NET 2003. Thanks
for any hints

The workaround is to turnn off the MessageQueue.EnableConnectionCache =
false. This will force a new connection each time.

You should do this whenever you are doing remote receives across anything
more than a server room switch.

But MSMQ is designed to work transparently across unstable connections. But
to take advantage of its reliable messaging capabilities you must follow
proper message queueing procedures. The rule is "Remote Sends and Local
Recieves". Have the remote machine send it back to a local queue for you.
This is what the Message.ResponseQueue property is for.

When you send a message to a remote queue, it goes into a local outgoing
queue and is sent as soon as a network connection is available. So, so long
as all messages are sent to a remote queue to be locally received, you have
guaranteed delivery across unreliable networks.

David
 
Back
Top