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

    Fields
    Modifier and Type
    Field
    Description
    static final co.elastic.clients.transport.rest5_client.low_level.HttpAsyncResponseConsumerFactory
    A consumer factory that safely wraps the one provided by RequestOptions.DEFAULT.
    static final co.elastic.clients.transport.rest5_client.low_level.RequestOptions
    Same as RequestOptions.DEFAULT with a safe consumer factory
  • Constructor Summary

    Constructors
    Constructor
    Description
    SafeResponseConsumer(org.apache.hc.core5.http.nio.AsyncResponseConsumer<T> delegate)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    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
    streamEnd(List<? extends org.apache.hc.core5.http.Header> trailers)
     
    void
    updateCapacity(org.apache.hc.core5.http.nio.CapacityChannel capacityChannel)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_FACTORY

      public static final co.elastic.clients.transport.rest5_client.low_level.HttpAsyncResponseConsumerFactory DEFAULT_FACTORY
      A consumer factory that safely wraps the one provided by RequestOptions.DEFAULT.
    • DEFAULT_REQUEST_OPTIONS

      public static final co.elastic.clients.transport.rest5_client.low_level.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