Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

subscribe to msmq

Tags:

c#

winforms

msmq

How to a subscribe to a queue in msmq using c#. Assuming i have a client as a win form and would like to subscribe to a que, everytime a message is arrived in the que i would like the form to be notified about it. Any example. Thanks

like image 823
np. Avatar asked Jul 23 '10 11:07

np.


2 Answers

You could also use WCF to subscribe to messages from an MSMQ queue and handle them as a service method in your WCF service.

Check out

  • How to Exchange messages with WCF endpoints and message queueing applications
  • WCF and MSMQ
  • Sample starter project with WCF and MSMQ
  • SOA'zing MSMQ with WCF (and why it's worth it)
like image 148
marc_s Avatar answered Oct 23 '22 04:10

marc_s


You need to look at the types in namespace System.Messaging.

There is full asynchronous support, so you can wait on a message arriving without halting your UI (but you'll need to use Control.BeginInvoke to call back into your UI as normal for asynchronous actions in WinForms).

MSDN has plenty of examples, e.g. of an asynchronous message receive.

like image 35
Richard Avatar answered Oct 23 '22 03:10

Richard