Help interpreting: MSMQ_.BeginPeek(new TimeSpan(0, 0, 5)).AsyncWaitHandle.WaitOne() RRS feed

  • Question

  •  Greetings:

    I'm trying to get familar with a procedure that uses Windows Message Queuing.  What's happening is - after the procedure is launched a thread is kicked off:

    MSMQ_ = new MessageQueue(path_);
    MSMQ_.SetPermissions(@"Everyone", MessageQueueAccessRights.FullControl, AccessControlEntryType.Allow);
    MSMQ_.Formatter = new XmlMessageFormatter(new Type[] { typeof(String) });

    MSMQ_.PeekCompleted += new PeekCompletedEventHandler(MSMQ__PeekCompleted);    // WHAT DOES THIS LINE ACCOMPLISH ??
    while (true) MainLoop();

    The MainLoop() method looks like this:

     private  void MainLoop()
                    MSMQ_.BeginPeek(new TimeSpan(0, 0, 5)).AsyncWaitHandle.WaitOne();   // WHAT'S GOING ON HERE??

    Before the thread is kicked off an XML file is saved with a node of data or a session.  This node looks like this:

     <session closed="False" id="12345">
        <TimeOpen>10/20/2008 10:45:41 AM</TimeOpen>

    When the user logs off the computer this node is supposed to be processed and removed.  Processing means all relevant data will be added to a database.

    At this point I'd simply like to understand the essence of the thread.

    • Moved by _larsw Monday, October 20, 2008 6:22 PM off-topic (Moved from Windows Communication Foundation to Where is the Forum For…?)
    Monday, October 20, 2008 4:37 PM


All replies