Class ExternalClientBuilder


  • public class ExternalClientBuilder
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ExternalClientBuilder​(io.dropwizard.setup.Environment environment, HttpClientConfiguration httpClientConfiguration, io.opentelemetry.api.OpenTelemetry openTelemetry)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T addFeature​(javax.ws.rs.core.Feature feature)
      Adds a feature used by the client.
      T addFilter​(javax.ws.rs.client.ClientRequestFilter clientRequestFilter)
      Adds a request filter to the client.
      <A> ApiClientBuilder<A> api​(java.lang.Class<A> apiInterface)
      Creates a client proxy implementation for accessing another service.
      <A> ApiClientBuilder<A> api​(java.lang.Class<A> apiInterface, java.lang.String customName)
      Creates a client proxy implementation for accessing another service.
      javax.ws.rs.client.Client buildGenericClient​(java.lang.String name)
      Builds a generic client that can be used for Http requests.
      T disableFollowRedirects()
      Set this client to not follow redirects and therewith automatically resolve 3xx status codes
      • Methods inherited from class java.lang.Object

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

      • ExternalClientBuilder

        public ExternalClientBuilder​(io.dropwizard.setup.Environment environment,
                                     HttpClientConfiguration httpClientConfiguration,
                                     io.opentelemetry.api.OpenTelemetry openTelemetry)
    • Method Detail

      • addFilter

        public T addFilter​(javax.ws.rs.client.ClientRequestFilter clientRequestFilter)
        Adds a request filter to the client.
        Parameters:
        clientRequestFilter - the filter to add
        Returns:
        this builder instance
      • addFeature

        public T addFeature​(javax.ws.rs.core.Feature feature)
        Adds a feature used by the client.
        Parameters:
        feature - to be added
        Returns:
        this builder instance
      • disableFollowRedirects

        public T disableFollowRedirects()
        Set this client to not follow redirects and therewith automatically resolve 3xx status codes
        Returns:
        this builder instance
      • buildGenericClient

        public javax.ws.rs.client.Client buildGenericClient​(java.lang.String name)
        Builds a generic client that can be used for Http requests.
        Parameters:
        name - the name of the client is used for metrics and thread names
        Returns:
        the client instance
      • api

        public <A> ApiClientBuilder<A> api​(java.lang.Class<A> apiInterface)
        Creates a client proxy implementation for accessing another service.
        Type Parameters:
        A - the type of the api
        Parameters:
        apiInterface - the interface that declares the API using JAX-RS annotations.
        Returns:
        a builder to define the root path of the API for the proxy that is build
      • api

        public <A> ApiClientBuilder<A> api​(java.lang.Class<A> apiInterface,
                                           java.lang.String customName)
        Creates a client proxy implementation for accessing another service. Allows to set a custom name if required, e.g. if you have multiple clients generated from the same interface.
        Type Parameters:
        A - the type of the api
        Parameters:
        apiInterface - the interface that declares the API using JAX-RS annotations.
        customName - the custom name to use for the client. The name is used for the executor service and metrics. Names have to be unique.
        Returns:
        a builder to define the root path of the API for the proxy that is build