Interface BrokerClient

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
BrokerClientImpl

public interface BrokerClient extends AutoCloseable
  • Method Details

    • start

      Starts broker client and associated services.
      Returns:
      a collection of futures for each of the service, which will be completed when the corresponding service is started.
    • close

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

      <T> CompletableFuture<BrokerResponse<T>> sendRequest(BrokerRequest<T> request)
      Sends a request to the partition if request specifies a partition, otherwise assign a partition send it to it.
      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

      <T> CompletableFuture<BrokerResponse<T>> sendRequest(BrokerRequest<T> request, Duration requestTimeout)
      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.
      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

      <T> CompletableFuture<BrokerResponse<T>> sendRequestWithRetry(BrokerRequest<T> request)
      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.
      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

      <T> CompletableFuture<BrokerResponse<T>> sendRequestWithRetry(BrokerRequest<T> request, Duration requestTimeout)
      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.
      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

      <T> void sendRequestWithRetry(BrokerRequest<T> request, BrokerResponseConsumer<T> responseConsumer, Consumer<Throwable> throwableConsumer)
      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.
      Parameters:
      request -
      responseConsumer - consumer that will be invoked when a successful response is received
      throwableConsumer - consumer that will be invoked on errors
    • getTopologyManager

      BrokerTopologyManager getTopologyManager()
    • subscribeJobAvailableNotification

      void subscribeJobAvailableNotification(String topic, Consumer<String> handler)