Interface TransportHttpClient

All Known Implementing Classes:
RestClientHttpClient

public interface TransportHttpClient
Minimal http client interface needed to implement an Elasticsearch transport.
  • Method Details

    • createOptions

      default TransportOptions createOptions(@Nullable TransportOptions options)
      Create a client-specific options value from an existing option object. If null, this must create the default options to which additional options can be added.

      This method allows implementations to return subclasses with more features (that applications can use by downcasting the result). By default, it will use DefaultTransportOptions.

    • performRequest

      TransportHttpClient.Response performRequest(String endpointId, @Nullable TransportHttpClient.Node node, TransportHttpClient.Request request, TransportOptions options) throws IOException
      Perform a blocking request.
      Parameters:
      endpointId - the endpoint identifier. Can be used to have specific strategies depending on the endpoint.
      node - the node to send the request to. If null, the implementation has to choose which node to send the request to, or throw an IllegalArgumentException.
      request - the request
      options - additional options for the http client. Headers and request parameters set in the options have precedence over those defined by the request and should replace them in the final request sent.
      Returns:
      the response
      Throws:
      IllegalArgumentException - if node is is null and the implementation cannot decide of a node to use.
      IOException
    • performRequestAsync

      Perform an asynchronous request.

      Implementations should return a CompletableFuture whose cancellation also cancels any http request in flight and frees the associated resources. This allows applications to implement scenarios like timeouts or "first to respond" fan-out without leaking resources.

      Parameters:
      endpointId - the endpoint identifier. Can be used to have specific strategies depending on the endpoint.
      node - the node to send the request to. If null, the implementation has to choose which node to send the request to, or throw an IllegalArgumentException.
      request - the request
      options - additional options for the http client. Headers and request parameters set in the options have precedence over those defined by the request and should replace them in the final request sent.
      Returns:
      a future that will be completed with the response.
    • close

      void close() throws IOException
      Close this client, freeing associated resources.
      Throws:
      IOException