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


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



Relevant Pages

  • Re: accessing printer thru print server
    ... I don't know which printserver you have, but for my Linksys EFSP42 ... The prefilter queue automatically converts any ... On one box I even forgot to set a remote queue name for it and it still ... logical queues L1-L8 for different configurations of the 2 printer ports, ...
    (comp.os.linux.networking)
  • RE: MSMQ Adapter Send Port [The time-to-reach-queue has elapsed]
    ... I'm not intimately familiar with MSMQ myself, but I do know that there are ... be aware of is messages being consumed off of the destination queue. ... BizTalk to the destination MSMQ queue and later come back to the sender's ... non-transactional response message over MSMQ Adapter to a remote queue, ...
    (microsoft.public.biztalk.general)
  • Re: Mysterious MSMQ exception
    ... Do you have the appropriate permissions to read from the remote queue? ... > Does anyone know what the MSMQ exception "Error occurs when reading from a ... > 2000 machine as queue server and Windows Professional machine as client. ...
    (microsoft.public.dotnet.framework)
  • lpr problems
    ... I am attempting to use lpr on a file of approx 300 MB ... I have set up a AIX remote queue pointing to a queue on NT. ... This also occurs if the remote queue is an AIX queue on another box. ...
    (AIX-L)
  • Re[2]: How does disk caching work?
    ... >> While you are correct that when cache is emtry kenrel will dip into the inactive queue. ... Pages on the cache queue still have the association. ... > You may want to study the kernel sources some more, ...
    (freebsd-performance)