converted to 1.6 markup
|Deletions are marked like this.||Additions are marked like this.|
|Line 6:||Line 6:|
|Line 11:||Line 11:|
| * [wiki:Self:UseCases/AsyncReceiveWhileSending send a request, receive response while still sending]
* [wiki:Self:UseCases/SingleAsyncRequestNotify single asynchronous request with notification]
* [wiki:Self:UseCases/AsyncRequestSequence send a request asynchronously, with automatic follow-up requests]
* [wiki:Self:UseCases/AsyncFireAndForget send a single request asynchronously, forget about the response]
* [wiki:Self:UseCases/MultiAsyncRequests multiple asynchronous requests]
| * [[UseCases/AsyncReceiveWhileSending|send a request, receive response while still sending]]
* [[UseCases/SingleAsyncRequestNotify|single asynchronous request with notification]]
* [[UseCases/AsyncRequestSequence|send a request asynchronously, with automatic follow-up requests]]
* [[UseCases/AsyncFireAndForget|send a single request asynchronously, forget about the response]]
* [[UseCases/MultiAsyncRequests|multiple asynchronous requests]]
Use Case: Single Asynchronous Request
I want to send a request for which I expect a long response time without blocking the application immediately.
Later, when my application needs the response, it will receive the response with a blocking operation.
Related / Out of Scope
This is the most basic case of asynchronous communication, possibly useful if the request includes a large body or if the server is expected to respond with a huge delay. It can be used to interlock HTTP communication with something else, but eventually the application has to receive the response synchronously, which limits the applicability.
The focus of this use case is the design of an interface for sending the request asynchronously, and for receiving the response synchronously. An initial implementation of that interface could spawn a background thread for each request that is sent. The responsibility for processing of the response headers can be assigned to the application thread as well as to the background thread.