Class SafeResponseConsumer<T>
java.lang.Object
co.elastic.clients.transport.rest_client.SafeResponseConsumer<T>
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.http.concurrent.Cancellable,org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>
public class SafeResponseConsumer<T>
extends Object
implements org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>
A response consumer that will propagate Errors as RuntimeExceptions to avoid crashing the IOReactor.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.elasticsearch.client.HttpAsyncResponseConsumerFactoryA consumer factory that safely wraps the one provided byRequestOptions.DEFAULT.static final org.elasticsearch.client.RequestOptionsSame asRequestOptions.DEFAULTwith a safe consumer factory -
Constructor Summary
ConstructorsConstructorDescriptionSafeResponseConsumer(org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T> delegate) -
Method Summary
Modifier and TypeMethodDescriptionbooleancancel()voidclose()voidconsumeContent(org.apache.http.nio.ContentDecoder decoder, org.apache.http.nio.IOControl ioControl) voidbooleanisDone()voidresponseCompleted(org.apache.http.protocol.HttpContext context) voidresponseReceived(org.apache.http.HttpResponse response)
-
Field Details
-
DEFAULT_FACTORY
public static final org.elasticsearch.client.HttpAsyncResponseConsumerFactory DEFAULT_FACTORYA consumer factory that safely wraps the one provided byRequestOptions.DEFAULT. -
DEFAULT_REQUEST_OPTIONS
public static final org.elasticsearch.client.RequestOptions DEFAULT_REQUEST_OPTIONSSame asRequestOptions.DEFAULTwith a safe consumer factory
-
-
Constructor Details
-
SafeResponseConsumer
-
-
Method Details
-
responseReceived
public void responseReceived(org.apache.http.HttpResponse response) throws IOException, org.apache.http.HttpException - Specified by:
responseReceivedin interfaceorg.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>- Throws:
IOExceptionorg.apache.http.HttpException
-
consumeContent
public void consumeContent(org.apache.http.nio.ContentDecoder decoder, org.apache.http.nio.IOControl ioControl) throws IOException - Specified by:
consumeContentin interfaceorg.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>- Throws:
IOException
-
responseCompleted
public void responseCompleted(org.apache.http.protocol.HttpContext context) - Specified by:
responseCompletedin interfaceorg.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>
-
failed
- Specified by:
failedin interfaceorg.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>
-
getException
- Specified by:
getExceptionin interfaceorg.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>
-
getResult
- Specified by:
getResultin interfaceorg.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>
-
isDone
public boolean isDone()- Specified by:
isDonein interfaceorg.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
cancel
public boolean cancel()- Specified by:
cancelin interfaceorg.apache.http.concurrent.Cancellable
-