473,503 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to manage a remote MessageQueue restarting?

I'm stumped. I'm working on an application in VB.Net that uses
System.Messaging.MessageQueue to listen for messages sent to a
private queue on a remote machine. Both machines are in the same
Workgroup in a small private LAN. The messaging is working fine, but
since the remote machine is used as a control system and has to be
rebooted when there is a configuration change, I have to handle the
remote queue going down and coming back up again. My application is
on the "local" machine, listening for messages and processing them
for a user interface.

I just can't figure out how to do that. I'm learning about
MessageQueue from the .Net Help and MSDN documentation and stuff I
can find on the internet. It looks like if I just keep the same
local MessageQueue object listening, it doesn't connect to the new
remote queue. I have to make a new MessageQueue on the local
machine, with a new handle.

If I kill the Message Queuing service on the remote machine, I can
detect that - it throws exceptions in the EndReceive method in my
ReceiveCompleted handler. But the real behavior is going to be
restarting the remote system, and when I try to mimic that on my
development machines, nothing happens in my local application. I've
tried using tests based on MessageQueue.Exists() but it seems that
the method doesn't work for remote machines in a Workgroup setting.
I thought maybe the CanRead() method would tell me if the remote
queue was "alive". I did a repeating timed loop that kept calling
CanRead(), but it kept returning TRUE all the way through the remote
machine's restart.

Any clues? There must be some documentation somewhere. People must
have to deal with this in their applications.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 20 '05 #1
2 2154
Well, it's getting more interesting. I was working on it over the
weekend, using my home desktop and laptop as the development
environment. Both run Windows 2000 Pro. Now I'm at work, where I
work on an XP Pro machine and have both my laptop and another
development machine with XP. I've discovered that if the remote
queue is on the XP machine, the ReceiveCompleted event seems to be
raised as soon as the remote queue goes down, and the EndReceive
method in the handler throws an exception. But if the remote queue
is on the laptop nothing happens until a long time later - as long as
15 minutes after the restart, the event and the exceptions started.

It turns out that the remote machine is going to be running Windows
2000 in the field, so now that I've found there are differences in
behavior, I have to find out the specifics of 2000 behavior.

I thought I would play around with putting a button on a form that
would just re-instantiate the MessageQueue object on the local
machine and let it re-connect to the restarted queue, and if that
works I would use that as a basis for my solution. But now I'm
finding that the local MessageQueue object is very inconsistent in
being able to find and connect to the remote queue.

I thought maybe I would try to Delete() the remote queue and then
Create() it new, but in a WorkGroup setting it turns out those
methods don't work at all.

Does anyone know about the details of how a MessageQueue running in an
application on an XP machine interacts with a queue on a 2000
machine? I'm running out of ideas to try.

Surely this must have been solved by someone at some time somewhere in
the world. I can't find any clues at MSDN, either

Here's hoping
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 20 '05 #2
Still can't find the answer, but there are more clues. I've studied
and dug more into it, and got some coaching from a guy who has lots
of experience with threading but none with MessageQueues. He has
looked at it and thinks the problem is with the callback that the
BeginReceive() method creates. Apparently when a remote XP system
goes down, any pending callback correctly comes back to the
ReceiveCompleted handler and completes the operation, so that when
the remote comes up again it's ready to reconnect with a simple
re-instantiation of the local MessageQueue object that listens to it.
But a 2000 system is not doing that, and leaves something hung up or
blocked and when the remote 2000 queue comes back, a new MessageQueue
object on the local machine can't make the re-connection and throws
exceptions. And what is really interesting is that if I separately
open the Windows Services from Control Panel and restart the Message
Queuing service, the next time I re-instantiate the local
MessageQueue object listening to the 2000 queue, it connects and
fetches any messages held in the queue there. I've already learned
that in general I have to clear the connection cache when I
reinstantiate MessageQueues, but there must be something else that is
"inside the system" somewhere in MessageQueuing, that gets
"refreshed" by restarting the Service, so now a new MessageQueue
object can make a new connection. Just an idea, and I don't know how
to go further with it.

Again, it's a clear difference in the way that MSMQ works on a 2000
system.

I learned that I could call BeginReceive with a timeout argument, and
I thought that that would take care of returning from a callback if
the remote queue went down, but it still doesn't solve it.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1969
by: Anibal David Acosta F. | last post by:
I want to access to MessageQueue from a remote machine, the path ".\private$\myQueue" only works locally, and the path "\\myServer\private$\myQueue" doesn't works. Do you know how can I access?...
3
5077
by: Gerhard Swart | last post by:
Hi all. I'm writing a queue browser that reads queues from a specified machine and then display the data that's on the queue. I am using the MessageQueue Class in .Net(C#). I get the problem...
6
11463
by: deepak | last post by:
I have to create message queue at remote machin. My code works properly when i use console application in c#. But it throws exception whenever i try it on web application in c#. My code is ...
4
2288
by: Ash | last post by:
Is there a built in classes in .NET to make it easy to read/write MSMQ messages to/from remote queues? If not then what is the best way to implement it?
0
2115
by: Marcus | last post by:
Hello All, I am trying to create a private MSMQ message queue on a remote application server from an asp.net application using the following code: Dim queue As MessageQueue queue =...
5
5731
by: felecha | last post by:
I have a VB.Net application that runs as a Windows Service and monitors a MessageQueue on another machine. At times that machine will have to be rebooted, so I've been working on how to get my...
4
1688
by: Risen | last post by:
Hi,All, I read MSDN about MessageQueue,and then I want to write some code to test MessageQueue in Vb.Net 2003. But there are some errors in code,and I don't know which code are incorrect. Who...
5
4994
by: Jason Richmeier | last post by:
I have been unable to locate an answer for this question because (1) it is late in the day and my eyes are tired of looking at code and documentation, (2) I am new to this area of the .NET...
0
1448
by: chi.chung.ko | last post by:
Dear Pals local:Windows XP Sp2 server:Windows 2K3 Sever R2 When Use to Receive MessageQueue On Server System.Messaging.MessageQueue IQ = new MessageQueue(); IQ.Path =...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7460
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.