Using Windows Services to process MSMQ messages via WCF
Asked Answered
D

2

2

We have a solution where we are picking the messages using Windows Service.

The Windows Service fires every after 2 minutes and retrieves the MSMQ message to pass it to a Web Service.

  1. Can I create a WCF service which will automatically picks up the messages from MSMQ Queue?
  2. Can I avoid Windows Service by using WCF Service if it support auto invocation?
Dia answered 16/12, 2008 at 22:6 Comment(0)
F
7

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

Fathometer answered 17/12, 2008 at 2:29 Comment(0)
M
2

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.

Makassar answered 31/1, 2009 at 19:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.