Class BrokerClientImpl

java.lang.Object
io.camunda.zeebe.gateway.impl.broker.BrokerClientImpl
All Implemented Interfaces:
BrokerClient, AutoCloseable

public final class BrokerClientImpl extends Object implements BrokerClient
  • Field Details

    • LOG

      public static final org.slf4j.Logger LOG
  • Constructor Details

  • Method Details

    • start

      public Collection<ActorFuture<Void>> start()
      Description copied from interface: BrokerClient
      Starts broker client and associated services.
      Specified by:
      start in interface BrokerClient
      Returns:
      a collection of futures for each of the service, which will be completed when the corresponding service is started.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface BrokerClient
    • sendRequest

      public <T> CompletableFuture<BrokerResponse<T>> sendRequest(BrokerRequest<T> request)
      Description copied from interface: BrokerClient
      Sends a request to the partition if request specifies a partition, otherwise assign a partition send it to it.
      Specified by:
      sendRequest in interface BrokerClient
      Parameters:
      request - request to send
      Returns:
      future which will be completed when a successful response from the broker is received. The future will be completed exceptionally on error or on receiving BrokerRejection.
    • sendRequest

      public <T> CompletableFuture<BrokerResponse<T>> sendRequest(BrokerRequest<T> request, Duration requestTimeout)
      Description copied from interface: BrokerClient
      Sends a request to the partition if request specifies a partition, otherwise assign a partition send it to it. The request times out after the specified requestTimeout.
      Specified by:
      sendRequest in interface BrokerClient
      Parameters:
      request - request to send
      requestTimeout - timeout for the request
      Returns:
      future which will be completed when a successful response from the broker is received. The future will be completed exceptionally on error or on receiving BrokerRejection.
    • sendRequestWithRetry

      public <T> CompletableFuture<BrokerResponse<T>> sendRequestWithRetry(BrokerRequest<T> request)
      Description copied from interface: BrokerClient
      Sends a request to the partition if request specifies a partition, otherwise assign a partition send it to it. If leader for that partition is not reachable the request will be resend until a timeout.
      Specified by:
      sendRequestWithRetry in interface BrokerClient
      Parameters:
      request - request to send
      Returns:
      future which will be completed when a successful response from the broker is received.The future will be completed exceptionally on error or on receiving BrokerRejection.
    • sendRequestWithRetry

      public <T> CompletableFuture<BrokerResponse<T>> sendRequestWithRetry(BrokerRequest<T> request, Duration requestTimeout)
      Description copied from interface: BrokerClient
      Sends a request to the partition if request specifies a partition, otherwise assign a partition send it to it. If leader for that partition is not reachable the request will be resend until the given requestTimeout.
      Specified by:
      sendRequestWithRetry in interface BrokerClient
      Parameters:
      request - request to send
      requestTimeout - timeout for the request
      Returns:
      future which will be completed when a successful response from the broker is received.The future will be completed exceptionally on error or on receiving BrokerRejection.
    • sendRequestWithRetry

      public <T> void sendRequestWithRetry(BrokerRequest<T> request, BrokerResponseConsumer<T> responseConsumer, Consumer<Throwable> throwableConsumer)
      Description copied from interface: BrokerClient
      Sends a request to the partition if request specifies a partition, otherwise assign a partition send it to it. If leader for that partition is not reachable the request will be resend until a timeout.
      Specified by:
      sendRequestWithRetry in interface BrokerClient
      responseConsumer - consumer that will be invoked when a successful response is received
      throwableConsumer - consumer that will be invoked on errors
    • getTopologyManager

      public BrokerTopologyManager getTopologyManager()
      Specified by:
      getTopologyManager in interface BrokerClient
    • subscribeJobAvailableNotification

      public void subscribeJobAvailableNotification(String topic, Consumer<String> handler)
      Specified by:
      subscribeJobAvailableNotification in interface BrokerClient