re:Reconnecting to a remote MessageQueue when it has to reboot
From: felecha (felechaji_at_yahoo-dot-com.no-spam.invalid)
Date: 02/27/04
- Next message: Brian Henry: "data bound listbox + data table select command"
- Previous message: Brent Burkart: "Re: distributing windows services"
- In reply to: felecha: "Reconnecting to a remote MessageQueue when it has to reboot"
- Messages sorted by: [ date ] [ thread ]
Date: 27 Feb 2004 09:23:44 -0600
Well I have stuff to learn still, I guess. I was able to get to the
groups directly through the google link, but earlier attempts gave
messages saying I needed newsreader software, which I don't know
about.
Anyway, I did see a post at one of the groups that led me to
msmqfaq.doc, where I found something that pretty much confirms me in
my conclusion about my problem. The items says:
4. An attempt to read from a remote queue fails with error
“invalid-handle.” Why?
This probably occurred because the remote computer has restarted, and
you use a cached queue handle that is no longer valid.
In core MSMQ, a local application uses a handle of the local MSMQ
service when reading from a remote queue, and the local MSMQ service
in turn has a remote queue handle from the remote computer. If the
remote computer restarts, the remote queue handle used by the local
MSMQ service is no longer valid. The standard workaround for this is
to close and reopen the queue. However, by default this workaround
does not work in the Microsoft .NET Framework, and the Close method
of the MessageQueue object does not close the queue handle. This is
because the .NET Framework uses a connections cache that caches queue
handles. To close a queue handle, either disable the connections
cache, or call ClearConnectionCache.
Well, it looks like the cache is the issue, but ... I already tried
disabling and clearing, and both steps led to other exceptions being
thrown.
Last night I tried another idea -- in the catch for the exception when
the remote queue goes down, I send an MSMQ Message to a LOCAL queue
that I set up, with a second little app running that has a
MessageQueue object that listens to THAT queue, and simply calls
ServiceController.Stop and ServiceController.Start on my Service, in
effect "rebooting" my Service in response to the reboot of the remote
machine. It keeps rebooting the Service every 5 seconds until the
remote queue comes up and then the connection is established and we
go on just fine.
It works consistently so far, but I still hope I can solve the cache
problem internally in the Service somehow. Creating apps to control
other apps bothers me.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
- Next message: Brian Henry: "data bound listbox + data table select command"
- Previous message: Brent Burkart: "Re: distributing windows services"
- In reply to: felecha: "Reconnecting to a remote MessageQueue when it has to reboot"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|