subscribe to msmq
Asked Answered
W

4

7

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

Worthy answered 23/7, 2010 at 11:6 Comment(0)
T
5

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

Tribal answered 23/7, 2010 at 11:58 Comment(0)
T
3

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.

Terrazas answered 23/7, 2010 at 11:11 Comment(0)
W
1

Why not take a look at NServiceBus?

It's a very stable and mature platform that is built on MSMQ, and has pub/sub right out of the box. Dead easy to get started with, and no need to get your hands dirty with WCF!

Wyler answered 7/11, 2011 at 11:23 Comment(0)
I
0

As suggested by @marc_s you can use WCF service which can use either NetMSMQ or MSMQIntegrated binding to subscribe to messages in the MSMQ.

If you don't want to introduce WCF service between the Winforms application and the MSMQ, you'll need to build a polling mechanism to check into MSMQ for arrival of new messages.

Inobservance answered 23/7, 2010 at 12:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.