Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to automatically read from MSMQ using vb.net

Status
Not open for further replies.
Sep 5, 2006
37
US
Hi,

I am a beginner and am trying to find out a way to read from MSMQ. I have an application that queues message on a MSMQ. Now I want to have another application that sould listen always on the queue and whenever a message arrives I am going to call some external Web Service passing on the data. As I work in Java/Oracle and this is a new requirement so trying to find out what is the best way to design this. Is there something that I can develop using VB.net or C# that basically listens on the queue and whenever a message arrives automatically picks it up and do further processing without any manuall intervention.

Using JMS I can have a Message Driven Bean for this but how can I do using MSMQ along with vb.net or C#.

Any help is appreciated.

Thanks
 
You'll want to investigate asyncronous message processing to have the queue call you when a message appears.

The basics are:
1. Open queue
2. Issue a BeginReceive call, specifying a method (delegate) to call you back on.
3. When that method gets called (as the result of someone dropping a message on the queue), call EndReceive, which returns you a Message object
4. Specify the formatter used by the message, after which you can examine the body of the message for your data.
5. If you want to receive future messages, issue another BeginReceive call.

The MSDN docs are pretty good, once you understand the concepts involved. It's just a little more manual than configuring your Bean under Java.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
So is there something that I deploy the application on the server and let it listens on the queue and the message arrives just do the processing. I don't want any manuall intervention as in java there is Message Driven Bean for this can I have the same functionality as MDB using vb.net or C#.

Thanks
 
You will need to write code. Sorry.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
I know I have to write a code all I want to find out is if there's something in vb.net or C# that provides a functionality just like Message Driven Beans (MDB) in Java.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top