Class CtAsyncHttpClient

java.lang.Object
io.vrap.rmf.base.client.HttpClientBase
com.commercetools.http.asynchttp.CtAsyncHttpClient
All Implemented Interfaces:
VrapHttpClient, Closeable, AutoCloseable

public class CtAsyncHttpClient extends HttpClientBase implements VrapHttpClient, AutoCloseable
  • Field Details

  • Constructor Details

    • CtAsyncHttpClient

      public CtAsyncHttpClient()
      Uses a ThrottleRequestFilter to limit the number of concurrent requests
    • CtAsyncHttpClient

      public CtAsyncHttpClient(int maxConnections)
      Uses a ThrottleRequestFilter to limit the number of concurrent requests
      Parameters:
      maxConnections - maximum number of parallel connections
    • CtAsyncHttpClient

      public CtAsyncHttpClient(BuilderOptions options)
      creates a default instance of the AsyncHttpClient
      Parameters:
      options - options to build the underlying HTTP client
    • CtAsyncHttpClient

      public CtAsyncHttpClient(int maxConnections, BuilderOptions options)
      Uses a ThrottleRequestFilter to limit the number of concurrent requests
      Parameters:
      maxConnections - maximum number of parallel connections
      options - options to build the underlying HTTP client
    • CtAsyncHttpClient

      public CtAsyncHttpClient(Supplier<org.asynchttpclient.DefaultAsyncHttpClientConfig.Builder> builderSupplier)
      creates a instance of the AsyncHttpClient using the provided builder
      Parameters:
      builderSupplier - builder with the configuration of the underlying HTTP client
    • CtAsyncHttpClient

      public CtAsyncHttpClient(ExecutorService executor)
      creates a default instance of the AsyncHttpClient
      Parameters:
      executor - ExecutorService to be used for the client
    • CtAsyncHttpClient

      public CtAsyncHttpClient(ExecutorService executor, int maxConnections)
      Uses a ThrottleRequestFilter to limit the number of concurrent requests
      Parameters:
      maxConnections - maximum number of parallel connections
      executor - ExecutorService to be used
    • CtAsyncHttpClient

      public CtAsyncHttpClient(ExecutorService executor, BuilderOptions options)
      creates a default instance of the AsyncHttpClient
      Parameters:
      executor - ExecutorService to be used for the client
      options - options to build the underlying HTTP client
    • CtAsyncHttpClient

      public CtAsyncHttpClient(ExecutorService executor, int maxConnections, BuilderOptions options)
      Uses a ThrottleRequestFilter to limit the number of concurrent requests
      Parameters:
      maxConnections - maximum number of parallel connections
      executor - ExecutorService to be used
      options - options to build the underlying HTTP client
    • CtAsyncHttpClient

      public CtAsyncHttpClient(ExecutorService executor, Supplier<org.asynchttpclient.DefaultAsyncHttpClientConfig.Builder> builderSupplier)
      creates a instance of the AsyncHttpClient using the provided builder
      Parameters:
      executor - ExecutorService to be used
      builderSupplier - builder with the configuration of the underlying HTTP client
  • Method Details

    • createClientBuilder

      public static org.asynchttpclient.DefaultAsyncHttpClientConfig.Builder createClientBuilder()
    • execute

      public CompletableFuture<ApiHttpResponse<byte[]>> execute(ApiHttpRequest httpRequest)
      executes a request
      Specified by:
      execute in interface VrapHttpClient
      Parameters:
      httpRequest - request to be executed
      Returns:
      response future
    • closeDelegate

      public void closeDelegate() throws Exception
      closes the underlying HTTP client
      Throws:
      Exception - in case of failure closing the client