Results 1 to 4 of 4

Thread: Restarting a remote MessageQueue on a W2K machine

Hybrid View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2004
    Posts
    5

    Restarting a remote MessageQueue on a W2K machine

    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. The system administrator will use my app.

    I'm learning about MessageQueue from the .Net Help and MSDN documentation and stuff I can find on the internet.

    The remote "Control system" machine is going to be running Windows 2000 in the field, and the local "Admin station" will run on XP. I've discovered in my development work there are differences in behavior depending on if the remote machine is 2000 or XP, so I have to find out the specifics of 2000 behavior. If the remote queue is XP, the ReceiveCompleted event is raised when the queue goes down, and the EndReceive method in the event handler throws an exception saying "Error occurs when reading from a queue on a remote computer." But with 2000, that doesn't happen. I have other means of knowing at the Admin station that the remote machine was restarted, soI thought I would play around with re-instantiating the MessageQueue object on the local machine and let it re-connect to the restarted queue. 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'm afraid that is another thing about MessageQueues on 2000

    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.

  2. #2
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618
    Never played with it before, but here's a silly question, have you tried google? I usually find better answers that way than by using MSDN. just search on "System.Messaging.MessageQueue"
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2004
    Posts
    5
    I've been everywhere on Google that I can find. The articles simply don't go down far enough into the details to get to my specific problem. I've searched on all the variations I can find, to narrow it down, or find that one forum post where someone talked about this detail, but no luck so far.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jun 2004
    Posts
    5
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width