Class HttpClient

java.lang.Object
io.camunda.zeebe.client.impl.http.HttpClient
All Implemented Interfaces:
AutoCloseable

public final class HttpClient extends Object implements AutoCloseable
Thin abstraction layer on top of Apache's HTTP client to wire up the expected Zeebe API conventions, e.g. errors are always ProblemDetail, content type is always JSON, etc.
  • Constructor Summary

    Constructors
    Constructor
    Description
    HttpClient(org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient client, com.fasterxml.jackson.databind.ObjectMapper jsonMapper, URI address, org.apache.hc.client5.http.config.RequestConfig defaultRequestConfig, int maxMessageSize, org.apache.hc.core5.util.TimeValue shutdownTimeout, CredentialsProvider credentialsProvider)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    <RespT> void
    delete(String path, org.apache.hc.client5.http.config.RequestConfig requestConfig, HttpZeebeFuture<RespT> result)
     
    <HttpT, RespT>
    void
    get(String path, org.apache.hc.client5.http.config.RequestConfig requestConfig, Class<HttpT> responseType, JsonResponseTransformer<HttpT,RespT> transformer, HttpZeebeFuture<RespT> result)
     
    org.apache.hc.client5.http.config.RequestConfig.Builder
    Creates a new request configuration builder with the default values.
    <RespT> void
    patch(String path, String body, org.apache.hc.client5.http.config.RequestConfig requestConfig, HttpZeebeFuture<RespT> result)
     
    <RespT> void
    post(String path, String body, org.apache.hc.client5.http.config.RequestConfig requestConfig, HttpZeebeFuture<RespT> result)
     
    void
     

    Methods inherited from class java.lang.Object

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

    • HttpClient

      public HttpClient(org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient client, com.fasterxml.jackson.databind.ObjectMapper jsonMapper, URI address, org.apache.hc.client5.http.config.RequestConfig defaultRequestConfig, int maxMessageSize, org.apache.hc.core5.util.TimeValue shutdownTimeout, CredentialsProvider credentialsProvider)
  • Method Details

    • start

      public void start()
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception
    • newRequestConfig

      public org.apache.hc.client5.http.config.RequestConfig.Builder newRequestConfig()
      Creates a new request configuration builder with the default values. The builder can be used to customize the request configuration for a specific request.
      Returns:
      a new request configuration builder
    • get

      public <HttpT, RespT> void get(String path, org.apache.hc.client5.http.config.RequestConfig requestConfig, Class<HttpT> responseType, JsonResponseTransformer<HttpT,RespT> transformer, HttpZeebeFuture<RespT> result)
    • post

      public <RespT> void post(String path, String body, org.apache.hc.client5.http.config.RequestConfig requestConfig, HttpZeebeFuture<RespT> result)
    • patch

      public <RespT> void patch(String path, String body, org.apache.hc.client5.http.config.RequestConfig requestConfig, HttpZeebeFuture<RespT> result)
    • delete

      public <RespT> void delete(String path, org.apache.hc.client5.http.config.RequestConfig requestConfig, HttpZeebeFuture<RespT> result)