Response Service

The programming model of queued calls described so far was one-sided: the client posted a one-way message to a queue, and the service processed that message. This model is sufficient when the queued operations are one-way calls by design. However, the queued service may need to report back to its client on the result of the invocation, returned results, and even errors. By default, however, this is not possible. WCF equates queued calls with one-way calls, which inherently forbids any such response. In addition, queued services (and their clients) are potentially disconnected. If the client posts a queued call to a disconnected service, when the service finally gets the messages and processes them, there may not be a client to return the values to because the client may be long gone. The solution is to have the service report back to a client-provided queued service. I call such a service a response service. [*] Figure 9-12 shows the architecture of such a solution.

A response service

Figure 9-12. A response service

The response service is just another queued service in the system. The response service may be disconnected toward the client as well and may be hosted in a separate process or a separate machine, or it can share the client’s process. If the response service shares the client’s process, then when the client is launched the response service will start processing the queued ...

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.