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 Details

    • DEFAULT_FACTORY

      public static final HttpAsyncResponseConsumerFactory DEFAULT_FACTORY
      A consumer factory that safely wraps the one provided by RequestOptions.DEFAULT.
    • DEFAULT_REQUEST_OPTIONS

      public static final RequestOptions DEFAULT_REQUEST_OPTIONS
      Same as RequestOptions.DEFAULT with a safe consumer factory
  • Constructor Details

    • SafeResponseConsumer

      public SafeResponseConsumer(org.apache.hc.core5.http.nio.AsyncResponseConsumer<T> delegate)
  • 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 interface org.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 interface org.apache.hc.core5.http.nio.AsyncResponseConsumer<T>
    • failed

      public void failed(Exception cause)
      Specified by:
      failed in interface org.apache.hc.core5.http.nio.AsyncResponseConsumer<T>
    • updateCapacity

      public void updateCapacity(org.apache.hc.core5.http.nio.CapacityChannel capacityChannel)
      Specified by:
      updateCapacity in interface org.apache.hc.core5.http.nio.AsyncDataConsumer
    • consume

      public void consume(ByteBuffer src)
      Specified by:
      consume in interface org.apache.hc.core5.http.nio.AsyncDataConsumer
    • streamEnd

      public void streamEnd(List<? extends org.apache.hc.core5.http.Header> trailers)
      Specified by:
      streamEnd in interface org.apache.hc.core5.http.nio.AsyncDataConsumer
    • releaseResources

      public void releaseResources()
      Specified by:
      releaseResources in interface org.apache.hc.core5.http.nio.ResourceHolder