I am trying to handle the poison messages in WCF with MSMQ transport.
I followed the below link for creating the original and poison services.
http://msdn.microsoft.com/en-us/library/aa395218.aspx
The only difference is instead of self hosting , I hosted the 2 servces in IIS with a single host project.
The configuration of both the services is below.
<services>
<service behaviorConfiguration="MainMSMQWCFService.Service1Behavior"
name="MainMSMQWCFService.OrderProcessorService">
<endpoint address="net.msmq://localhost/private/servicemodelsamplespoison"
binding="netMsmqBinding" bindingConfiguration="PoisonBinding"
contract="MainMSMQWCFService.IOrderProcessor" />
</service>
<service behaviorConfiguration="MainMSMQWCFService.PoisonHandlingServiceBehavior"
name="MainMSMQWCFService.PoisonHandlingService">
<endpoint address="net.msmq://localhost/private/servicemodelsamplespoison;poison"
binding="netMsmqBinding"
bindingConfiguration="PoisonBinding2"
contract="MainMSMQWCFService.IOrderProcessor">
</endpoint>
</service>
</services>
Both services are running properly.
The issue is when the message is put into the poison queue, the poison service is not processing the message. I observed the messages in Poison queue, they are targeting to original service only. then how the poison service can process them? after going through MSDN , I got to know that by setting Service behavior attribute , WCF channel takes care this issue. The following paragraoh explains the same.
"Messages in the poison message queue are messages that are addressed to the service that is processing the message, which could be different from the poison message service endpoint. Therefore, when the poison message service reads messages from the queue, the WCF channel layer finds the mismatch in endpoints and does not dispatch the message. In this case, the message is addressed to the order processing service but is being received by the poison message service. To continue to receive the message even if the message is addressed to a different endpoint, we must add a ServiceBehavior to filter addresses where the match criterion is to match any service endpoint the message is addressed to. This is required to successfully process messages that you read from the poison message queue."
But my poison service is not processing the poisoned messages?
I am not able to figure out the issue.