WCF MSMQ queue listener with periodic check

I have a MSMQ queue and I need to implement a listener that is executed periodically or at specified time (ie nightly) to process messages in the queue.

WCF provides netMsmqBinding that allows sending messages to other service via MSMQ. I wonder is it possible to implement the WCF service to consume messages at specified time or periodically in equal intervals? Or WCF always consumes message as soon as it arrives?

For example I need to check queue every hour, and if there are any messages - process them.

One more question is about concurrency. Can I configure WCF service to use limited number of threads (eg 2) for queue message handling?

Thanks


Your best bet is to host the MSMQ consumer in a windows service and then configure a windows scheduled task to start it up and shut it down (eg with a powershell script) as per your service window requirements.

EDIT : I believe NServiceBus sagas can also support this requirement but it does not use WCF.

链接地址: http://www.djcxy.com/p/55808.html

上一篇: 使用WCF消耗MSMQ

下一篇: 定期检查WCF MSMQ队列侦听器