• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 493
  • Last Modified:

Reading Messages from MSMQ


I am totally new to MSMQ. My requirement is something like this:
I know the path of message queue and i have to go through all the messages in that queue every 10 min....and check if there is any message which came in and is not proccessed and still is in queue for more than 10 min...then i have to perform certain functions or say display an alert message to user.

How do i read the message list and check the time it is being lying in the queue.

Some sample code would be great. My application is in C# ASP.NET 2.0

  • 2
1 Solution
Code Snippet: Receiving a message in the .NET service:
MessageQueue MyMessageQ;
Message MyMessage;
MyMessageQ = new MessageQueue(_QueuePath);
MyMessage = MyMessageQ.Receive;      
WriteStatus("Message Received!");
WriteStatus("Processing Finished!");

Source: Leveraging MSMQ in ASP.NET Applications

How to do asynchronous programming using ASP.NET, MSMQ and Windows Service, for long running processes
ziorrinfotechAuthor Commented:
when i unse sendtime property of message it give me exception and give this msg please use correct property filer in the reciveced mesage.
so how i get the send time of the message
ziorrinfotechAuthor Commented:
I got it..i also have to set MsgQ.MessageReadPropertyFilter.ArrivedTime = true;
before reading it.
@ i also have to set MsgQ.MessageReadPropertyFilter.ArrivedTime = true;
great efforts dude !
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now