Queued Calls

WCF provides support for queued calls using the NetMsmqBinding. Instead of transporting the message over TCP, HTTP, or IPC, WCF transports the message over MSMQ. WCF packages the WCF 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 on. 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 and discounted. The calls will execute later on when the service processes the messages (which makes it asynchronous) and the service or client may interact with local queues (which enables disconnected calls).

Queued Calls Architecture

As with every WCF 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 address. ...

Get Programming WCF Services 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.