I have create a WCF service and am utilising netMsmqBinding binding.
This is a simple service that passes a Dto to my service method and does not expect a response. The message is placed in an MSMQ, and once picked up inserted into a database.
What is the best method to make sure no data is being lost.
I have tried the 2 following methods:
Throw an exception
This places the message in a dead letter queue for manual perusal. I can process this when my strvice starts
set the receiveRetryCount="3" on the binding
After 3 tries - which happen instantanously, this seems to leave the message in queue, but fault my service. Restarting my service repeats this process.
Ideally I would like to do the follow:
Try process the message
- If this fails, wait 5 minutes for that message and try again.
- If that process fails 3 times, move the message to a dead letter queue.
- Restarting the service will push all messages from the dead letter queue back into the queue so that it can be processed.
Can I achieve this? If so how? Can you point me to any good articles on how best to utilize WCF and MSMQ for my given sceneria.
Any help would be much appreciated. Thanks!
Some additional information
I am using MSMQ 3.0 on Windows XP and Windows Server 2003. Unfortunately I can't use the built in poison message support targeted at MSMQ 4.0 and Vista/2008.