Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Reading Messages from MSMQ

Posted on 2007-08-06
4
Medium Priority
?
464 Views
Last Modified: 2013-12-17
Hi

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

Mahesh
0
Comment
Question by:ziorrinfotech
  • 2
4 Comments
 
LVL 53

Accepted Solution

by:
Dhaest earned 1000 total points
ID: 19638922
Code Snippet: Receiving a message in the .NET service:
MessageQueue MyMessageQ;
Message MyMessage;
MyMessageQ = new MessageQueue(_QueuePath);
MyMessage = MyMessageQ.Receive;      
WriteStatus("Message Received!");
DoSomeLongRunningProcess();
WriteStatus("Processing Finished!");

Source: Leveraging MSMQ in ASP.NET Applications
http://www.15seconds.com/Issue/031202.htm



How to do asynchronous programming using ASP.NET, MSMQ and Windows Service, for long running processes
http://www.codeproject.com/dotnet/Using_MSMQ_ASPnet_Window.asp
0
 

Author Comment

by:ziorrinfotech
ID: 19644573
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
0
 

Author Comment

by:ziorrinfotech
ID: 19644760
I got it..i also have to set MsgQ.MessageReadPropertyFilter.ArrivedTime = true;
before reading it.
0
 
LVL 2

Expert Comment

by:tppradeep18
ID: 19644921
@ i also have to set MsgQ.MessageReadPropertyFilter.ArrivedTime = true;
great efforts dude !
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Integration Management Part 2
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question