Asynchronous Response Handler
A client calls a web service.
How can a client avoid blocking when sending a request?
Client applications often block while waiting for responses. The time the client spends waiting could, in many cases, be used to perform other tasks. Some would suggest that the service should be reengineered to use an asynchronous pattern like Request/Acknowledge. The problem is that migrating to an asynchronous interaction style like this isn't easy, nor is it always recommended. How can clients take advantage of the time a service processes requests without having to migrate to a completely asynchronous interaction style?
Dispatch requests on a separate thread of execution apart from the main client thread. Wait for the response on this thread while attending to other matters on the main thread.
The Asynchronous Response Handler pattern addresses the problem of blocking on the client thread that calls a service. It enables clients to do other things once the request has been sent. This pattern has two forms. The first is the Polling Method, and the second is the Client-side Callback. The difference between the two is the way the Service Connector handles the response. With the polling method, the client must periodically invoke a method on the connector to see if the response has been received. With the callback variation, the connector notifies a Callback Handler when the response has arrived.