T - The message body type.public class BasicRequestConsumer<T> extends Object implements AsyncRequestConsumer<Message<HttpRequest,T>>
AsyncRequestConsumer that represents the request message as
a Message and relies on a AsyncEntityConsumer to process request entity stream.| Constructor and Description |
|---|
BasicRequestConsumer(AsyncEntityConsumer<T> dataConsumer) |
BasicRequestConsumer(Supplier<AsyncEntityConsumer<T>> dataConsumerSupplier) |
| Modifier and Type | Method and Description |
|---|---|
void |
consume(ByteBuffer src)
Triggered to pass incoming data to the data consumer.
|
void |
consumeRequest(HttpRequest request,
EntityDetails entityDetails,
HttpContext httpContext,
FutureCallback<Message<HttpRequest,T>> resultCallback)
Triggered to signal receipt of a request message head.
|
void |
failed(Exception cause)
Triggered to signal a failure in data processing.
|
void |
releaseResources() |
void |
streamEnd(List<? extends Header> trailers)
Triggered to signal termination of the data stream.
|
void |
updateCapacity(CapacityChannel capacityChannel)
Triggered to signal ability of the underlying data stream to receive
data capacity update.
|
public BasicRequestConsumer(Supplier<AsyncEntityConsumer<T>> dataConsumerSupplier)
public BasicRequestConsumer(AsyncEntityConsumer<T> dataConsumer)
public void consumeRequest(HttpRequest request, EntityDetails entityDetails, HttpContext httpContext, FutureCallback<Message<HttpRequest,T>> resultCallback) throws HttpException, IOException
AsyncRequestConsumerconsumeRequest in interface AsyncRequestConsumer<Message<HttpRequest,T>>request - the request message head.entityDetails - the request entity details or null if the request
does not enclose an entity.httpContext - the actual execution context.resultCallback - the result callback called when request processing
has been completed successfully or unsuccessfully.HttpException - in case of an HTTP protocol violation.IOException - in case of an I/O error.public void updateCapacity(CapacityChannel capacityChannel) throws IOException
AsyncDataConsumerupdateCapacity in interface AsyncDataConsumercapacityChannel - the channel for capacity updates.IOException - in case of an I/O error.public void consume(ByteBuffer src) throws IOException
AsyncDataConsumerconsume in interface AsyncDataConsumersrc - data source.IOException - in case of an I/O error.public void streamEnd(List<? extends Header> trailers) throws HttpException, IOException
AsyncDataConsumerstreamEnd in interface AsyncDataConsumertrailers - data stream trailers.HttpException - in case of an HTTP protocol violation.IOException - in case of an I/O error.public void failed(Exception cause)
AsyncRequestConsumerfailed in interface AsyncRequestConsumer<Message<HttpRequest,T>>cause - the cause of the failure.public void releaseResources()
releaseResources in interface ResourceHolderCopyright © 2005–2021 The Apache Software Foundation. All rights reserved.