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
Modifier and TypeFieldDescriptionstatic final org.elasticsearch.client.HttpAsyncResponseConsumerFactory
A consumer factory that safely wraps the one provided byRequestOptions.DEFAULT
.static final org.elasticsearch.client.RequestOptions
Same asRequestOptions.DEFAULT
with a safe consumer factory -
Constructor Summary
ConstructorDescriptionSafeResponseConsumer
(org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T> delegate) -
Method Summary
Modifier and TypeMethodDescriptionboolean
cancel()
void
close()
void
consumeContent
(org.apache.http.nio.ContentDecoder decoder, org.apache.http.nio.IOControl ioControl) void
boolean
isDone()
void
responseCompleted
(org.apache.http.protocol.HttpContext context) void
responseReceived
(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.DEFAULT
with 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:
responseReceived
in interfaceorg.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>
- Throws:
IOException
org.apache.http.HttpException
-
consumeContent
public void consumeContent(org.apache.http.nio.ContentDecoder decoder, org.apache.http.nio.IOControl ioControl) throws IOException - Specified by:
consumeContent
in interfaceorg.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>
- Throws:
IOException
-
responseCompleted
public void responseCompleted(org.apache.http.protocol.HttpContext context) - Specified by:
responseCompleted
in interfaceorg.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>
-
failed
- Specified by:
failed
in interfaceorg.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>
-
getException
- Specified by:
getException
in interfaceorg.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>
-
getResult
- Specified by:
getResult
in interfaceorg.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>
-
isDone
public boolean isDone()- Specified by:
isDone
in interfaceorg.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
cancel
public boolean cancel()- Specified by:
cancel
in interfaceorg.apache.http.concurrent.Cancellable
-