Class SafeResponseConsumer<T>
java.lang.Object
co.elastic.clients.transport.rest5_client.SafeResponseConsumer<T>
- All Implemented Interfaces:
org.apache.hc.core5.http.nio.AsyncDataConsumer
,org.apache.hc.core5.http.nio.AsyncResponseConsumer<T>
,org.apache.hc.core5.http.nio.ResourceHolder
public class SafeResponseConsumer<T>
extends Object
implements org.apache.hc.core5.http.nio.AsyncResponseConsumer<T>
A response consumer that will propagate Errors as RuntimeExceptions to avoid crashing the IOReactor.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HttpAsyncResponseConsumerFactory
A consumer factory that safely wraps the one provided byRequestOptions.DEFAULT
.static final RequestOptions
Same asRequestOptions.DEFAULT
with a safe consumer factory -
Constructor Summary
ConstructorsConstructorDescriptionSafeResponseConsumer
(org.apache.hc.core5.http.nio.AsyncResponseConsumer<T> delegate) -
Method Summary
Modifier and TypeMethodDescriptionvoid
consume
(ByteBuffer src) void
consumeResponse
(org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.http.EntityDetails entityDetails, org.apache.hc.core5.http.protocol.HttpContext context, org.apache.hc.core5.concurrent.FutureCallback<T> resultCallback) void
void
informationResponse
(org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.http.protocol.HttpContext context) void
void
void
updateCapacity
(org.apache.hc.core5.http.nio.CapacityChannel capacityChannel)
-
Field Details
-
DEFAULT_FACTORY
A consumer factory that safely wraps the one provided byRequestOptions.DEFAULT
. -
DEFAULT_REQUEST_OPTIONS
Same asRequestOptions.DEFAULT
with a safe consumer factory
-
-
Constructor Details
-
SafeResponseConsumer
-
-
Method Details
-
consumeResponse
public void consumeResponse(org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.http.EntityDetails entityDetails, org.apache.hc.core5.http.protocol.HttpContext context, org.apache.hc.core5.concurrent.FutureCallback<T> resultCallback) - Specified by:
consumeResponse
in interfaceorg.apache.hc.core5.http.nio.AsyncResponseConsumer<T>
-
informationResponse
public void informationResponse(org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.http.protocol.HttpContext context) - Specified by:
informationResponse
in interfaceorg.apache.hc.core5.http.nio.AsyncResponseConsumer<T>
-
failed
- Specified by:
failed
in interfaceorg.apache.hc.core5.http.nio.AsyncResponseConsumer<T>
-
updateCapacity
public void updateCapacity(org.apache.hc.core5.http.nio.CapacityChannel capacityChannel) - Specified by:
updateCapacity
in interfaceorg.apache.hc.core5.http.nio.AsyncDataConsumer
-
consume
- Specified by:
consume
in interfaceorg.apache.hc.core5.http.nio.AsyncDataConsumer
-
streamEnd
- Specified by:
streamEnd
in interfaceorg.apache.hc.core5.http.nio.AsyncDataConsumer
-
releaseResources
public void releaseResources()- Specified by:
releaseResources
in interfaceorg.apache.hc.core5.http.nio.ResourceHolder
-