I am running a WCF client that invokes a WCF service through MsmqBinding. Framework.Net 4.0, client and server running on Windows Server 2008 R2. The channel queue is transactional.
The service is hosted with these binding parameters: receiveErrorHandling="Move" receiveRetryCount="3" retryCycleDelay="00:00:20" maxRetryCycles="5"
Given that ((ReceiveRetryCount + 1) * (MaxRetryCycles + 1)) is valid, this will cause 4 * 6 = 24 repetitions of any given message until it is moved to the poisonous subarea.
Joining IErrorHandler to my service. I notice that HandleError is thrown with an MsmqPoisonMessageException exception a total of 6 times (for a poisonous message) before the wcf subsystem finally moves the message to the poison sublanguage.
I want to record the exact time when the message is running, and the message is moved to the poison queue. It seems to me that the only option is to count the number of errors of a particular message and compare this number with the MaxRetryCycles binding. This is inconvenient and erroneous.
My question is:
- Is there a way for me to finally detect an event when the wcf subsystem moves a message to a poison queue?
My links: http://msdn.microsoft.com/en-us/library/aa395218.aspx
And: http://consultingblogs.emc.com/simonevans/archive/2007/09/17/A-comprehensive-guide-to-using-MsmqIntegrationBinding-with-MSMQ-3.0-in-WCF.aspx
source share