locked
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_.Purge();
    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()
     {
                try
                {
                    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:

    <QStatus>
     <session closed="False" id="12345">
        <User>MyDomain\JoeSmith</User>
        <Server>
        </Server>
        <ServerID>123</ServerID>
        <Type>Console</Type>
        <TimeOpen>10/20/2008 10:45:41 AM</TimeOpen>
        <Hash>757661455</Hash>
      </session>
    </QStatus>

    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.

    Thanks!
    • 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

Answers

All replies