views:

978

answers:

3
+1  Q: 

WCF and MSMQ

Hi,

Can any help me to find the answer of the following questions.

We have a solution where we are picking the messages using Windows Service Service fires every after 2 minutes and pick the message to pass it ot a web Service.

Q1- Can i create a WCF service which will automatically pick the messages from MSMQ Queue. Q2- Can I avoid Windows Service by using WCF Service if it support auto invocation.

Thanks in advance.

Regards

+3  A: 

Q1: you can automatically pick up messages from MSMQ, you will need to look into the netmsmqbinding, there are some design considerations that you have to think about though, if you are used to the native MSMQ, you know that you have the ability to peek at the messages. But when you use WCF, you loose that ability to peek. WCF will intercept the messages in MSMQ and you are responsible for keeping your WCF service and the peeking app in synch. You will also need to look into whether you need transactional or non-transactional queues and you will have to modify your binding based on that.

Q2: You will need to host the WCF service in windows service or in IIS7. if you host in IIS7 look into enabling MSMQ WAS listener

Here is a nice article: http://blogs.msdn.com/tomholl/archive/2008/07/12/msmq-wcf-and-iis-getting-them-to-play-nice-part-1.aspx

Tina Endresen
A: 

i have seen the article by Tom Hollander but it was not clear for me any other article which is more clear and explainatory?

+1  A: 

One way to transfer messages from an MSMQ to a web service call is to use a netMsmqBinding service endpoint and a basicHttpBinding client endpoint that support the same contract. The netMsmq service will automatically grab messages from the queue and deserialize them into an object. In your implementation of your netMsmq service, just instantiate your basicHttp client proxy and just call the same method. Basically a pass-through or proxy pattern from the web-service to the MSMQ and vice-versa. In Juval Lowy's "Programming WCF" he calls this pattern the "HTTP Bridge" for queues.

Andy White