views:

429

answers:

1

I have built a WCF load balancer/router to conditionally route any one way service to multiple endpoints all using MSMQ bindings. I have also created a host that uses all the endpoints from the router to accept the service calls. All the endpoint specifies the same contract.

I need each queue (endpoint) to be processed concurrently but each service call to be processed sequentially.

I’ve tried using InstanceContextMode = InstanceContextMode.Single and ConcurrencyMode = ConcurrencyMode.Single but this only gives me single instance processing all of my endpoints. InstanceContextMode = PerCall does not guarantee ordering which I need.
What I need is a single service instance per endpoint that will run concurrently.

I’ve also tried various permutations using the ServiceBehavior of ReleaseServiceInstanceOnTransactionComplete = true/false.

How would I accomplish this with WCF using MSMQ bindings?

A: 

Place your configuration so it will be a little clearer. You can also control how WCF execute the calls by defining your own synchronization context. I had to it for another project and I posted the code in this article

http://www.codeproject.com/KB/threads/SynchronizationContext3.aspx