AsyncResponseConsumer
that publishes the response body through
a Publisher
, as defined by the Reactive Streams specification. The
response is represented as a Message
consisting of a HttpResponse
representing the headers and a Publisher
representing
the response body as an asynchronous stream of ByteBuffer
instances.
Modifier and Type | Field and Description |
---|---|
private volatile EntityDetails | |
private volatile HttpResponse | |
private final ReactiveDataConsumer | |
private volatile BasicFuture | |
private final BasicFuture | |
private final List |
Access | Constructor and Description |
---|---|
public | |
public | ReactiveResponseConsumer(final FutureCallback<Message<HttpResponse, Publisher<ByteBuffer>>>
the callback to invoke when the response is available for consumption. responseCallback)Creates a |
Modifier and Type | Method and Description |
---|---|
public void | consume(final ByteBuffer
data source. src)Implements org. |
public void | consumeResponse(final HttpResponse
the response message head. response, final EntityDetails the response entity details or entityDetails, final HttpContext null if the response
does not enclose an entity.the actual execution context. httpContext, final FutureCallback<Void> the result callback called when response processing
has been completed successfully or unsuccessfully. resultCallback)Implements org. |
public void | failed(final Exception
the cause of the failure. cause)Implements org. |
public EntityDetails | |
public HttpResponse | Returns: the information response, ornull if none.Returns the intermediate (1xx) HTTP response if one was received. |
public Future | |
public List | Returns: a non-null list of zero or more trailers.Returns the trailers received at the end of the response. |
public void | informationResponse(final HttpResponse
the intermediate (1xx) HTTP response. response, final HttpContext the actual execution context. httpContext)Implements org. |
public void | |
public void | streamEnd(final List<? extends Header>
data stream trailers. trailers)Implements org. |
public void | updateCapacity(final CapacityChannel
the channel for capacity updates. capacityChannel)Implements org. |
entityDetails | back to summary |
---|---|
private volatile EntityDetails entityDetails |
informationResponse | back to summary |
---|---|
private volatile HttpResponse informationResponse |
reactiveDataConsumer | back to summary |
---|---|
private final ReactiveDataConsumer reactiveDataConsumer |
responseCompletion | back to summary |
---|---|
private volatile BasicFuture<Void> responseCompletion |
responseFuture | back to summary |
---|---|
private final BasicFuture<Message<HttpResponse, Publisher<ByteBuffer>>> responseFuture |
trailers | back to summary |
---|---|
private final List<Header> trailers |
ReactiveResponseConsumer | back to summary |
---|---|
public ReactiveResponseConsumer() Creates a |
ReactiveResponseConsumer | back to summary |
---|---|
public ReactiveResponseConsumer(final FutureCallback<Message<HttpResponse, Publisher<ByteBuffer>>> responseCallback) Creates a
|
consume | back to summary |
---|---|
public void consume(final ByteBuffer src) throws IOException Implements org. Doc from org. Triggered to pass incoming data to the data consumer. The consumer must consume the entire content of the data buffer. The consumer must stop incrementing its capacity on the capacity channel if it is unable to accept more data. Once the data consumer has handled accumulated data or allocated more intermediate storage it can update its capacity information on the capacity channel.
|
consumeResponse | back to summary |
---|---|
public void consumeResponse(final HttpResponse response, final EntityDetails entityDetails, final HttpContext httpContext, final FutureCallback<Void> resultCallback) Implements org. Doc from org. Triggered to signal receipt of a response message head.
|
failed | back to summary |
---|---|
public void failed(final Exception cause) Implements org. Doc from org. Triggered to signal a failure in data processing. |
getEntityDetails | back to summary |
---|---|
public EntityDetails getEntityDetails() Returns the response entity details.
|
getInformationResponse | back to summary |
---|---|
public HttpResponse getInformationResponse() Returns the intermediate (1xx) HTTP response if one was received.
|
getResponseFuture | back to summary |
---|---|
public Future |
getTrailers | back to summary |
---|---|
public List Returns the trailers received at the end of the response. |
informationResponse | back to summary |
---|---|
public void informationResponse(final HttpResponse response, final HttpContext httpContext) Implements org. Doc from org. Triggered to signal receipt of an intermediate (1xx) HTTP response.
|
releaseResources | back to summary |
---|---|
public void releaseResources() Implements org.
|
streamEnd | back to summary |
---|---|
public void streamEnd(final List<? extends Header> trailers) Implements org. Doc from org. Triggered to signal termination of the data stream. |
updateCapacity | back to summary |
---|---|
public void updateCapacity(final CapacityChannel capacityChannel) throws IOException Implements org. Doc from org. Triggered to signal ability of the underlying data stream to receive data capacity update. The data consumer can choose to write data immediately inside the call or asynchronously at some later point.
|