We help IT Professionals succeed at work.
Get Started

MSMQ active message

Berico
Berico asked
on
349 Views
Last Modified: 2012-08-13
I have written a windows service and process messages in a queue and sends and email per each message. I am also writing a windows application that monitors this queue and should determine which message is currently being send. Is there any way to look at a queue externally and determines which message is currently active. This is my winodws service peekcompeleted method:

 private void MyQueue_PeekCompleted(object sender, PeekCompletedEventArgs e)
        {
           
           
            try
            {
             
                incomingmessage = MyQueue.EndReceive(e.AsyncResult);
                incomingmessage.Formatter = new BinaryMessageFormatter();
                sendemail.sendqueuemail(incomingmessage);
                //During this stage when mail is being sent my external
               // application need to know the ID of the message
       
            }
            catch
            {
               

            }
            finally
            {
               // remove the message from the queue if its matches
                 EBTSQueue.Receive();
                 //refresh the Queue
                 EBTSQueue.Refresh();
                // start watching for another message
                EBTSQueue.BeginPeek();
            }
        }
Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE