0
votes

I have a MSMQ queue and I need to implement a listener that is executed periodically or at specified time (i.e. 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 (e.g. 2) for queue message handling?

Thanks

1

1 Answers

0
votes

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.