Instance Management
The contract session mode and the service instance mode
have a paramount effect on the behavior of the queued calls, the way the
calls are played back to the service, and the overall program workflow
and allowed assumptions. The MSMQ binding cannot maintain a transport
session in the connected sense, since the client is inherently
disconnected. Instead, the equivalent MSMQ concept is called a
sessiongram. If the contract is
configured with SessionMode.Allowed
(the default) or SessionMode.NotAllowed
, there will be no
sessiongram. Every call the client makes on the proxy will be converted
to a single WCF message, and those WCF messages will be placed in
individual MSMQ messages and posted to the queue. A client making two
calls on the proxy will result in two MSMQ messages. If the contract is
configured with SessionMode.Required
,
all the calls made by the client against the same proxy will be packaged
in a single MSMQ message, in the order in which they were made and
posted to the queue. On the service side, WCF will play the calls from
the MSMQ message in the order they were made (like a recording) to the
same service instance. This mode is therefore analogous to a transport
session and a sessionful service.
Per-Call Queued Services
In the case of a per-call service, the client has no way of knowing whether its calls will eventually end up being played to a queued per-call service. All the client sees is the session mode of the contract. If the session mode is either ...
Get Programming WCF Services, 3rd 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.