Concurrency Management
As with a connected service, the ConcurrencyMode
property governs concurrent playback of queued messages. With a per-call service, all queued
messages are played at once to different instances as fast as they come off the queue, up to
the limit of the configured throttle. There is no need to configure for reentrancy to
support callbacks, because the operation contexts can never have callback references. There
is also no need to configure for multiple concurrent access, because no two messages will
ever share an instance. In short, with a queued per-call service, the concurrency mode is
ignored.
When it comes to a sessionful queued service, you are required to configure the service
with ConcurrencyMode.Single
. The reason is that it is the
only concurrency mode that allows you to turn off auto-completion, which is essential to
maintain the session semantic. The calls in the message are always played to the same
service instance, one at a time.
A queued singleton is really the only instancing mode that has any leeway with its
concurrency mode. If the singleton is configured with ConcurrencyMode.Single
, WCF will retrieve the messages all at once from the
queue (up to the thread pool and throttling limits) and then queue up the calls in the
internal queue the context lock maintains. Calls will be dispatched to the singleton one at
a time. If the singleton is configured with ConcurrencyMode.Multiple
, WCF will retrieve the messages all at once from the queue (up to ...
Get Programming WCF Services, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.