Queued Calls

WCF provides support for queued calls using the NetMsmqBinding. With this binding, instead of transporting the messages over TCP, HTTP, or IPC, WCF transports the messages over MSMQ. WCF packages each SOAP message into an MSMQ message and posts it to a designated queue. Note that there is no direct mapping of WCF messages to MSMQ messages, just like there is no direct mapping of WCF messages to TCP packets. A single MSMQ message can contain multiple WCF messages, or just a single one, according to the contract session mode (as discussed at length later). In effect, instead of sending the WCF message to a live service, the client posts the message to an MSMQ queue. All that the client sees and interacts with is the queue, not a service endpoint. As a result, the calls are inherently asynchronous (because they will execute later, when the service processes the messages) and disconnected (because the service or client may interact with local queues).

Queued Calls Architecture

As with every WCF service, in the case of a queued service the client interacts with a proxy, as shown in Figure 9-2.

Queued calls architecture

Figure 9-2. Queued calls architecture

However, since the proxy is configured to use the MSMQ binding, it does not send the WCF message to any particular service. Instead, it converts the call (or calls) to an MSMQ message (or messages) and posts it to the queue specified in the endpoint’s ...

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.