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();
}
}