Class BrokerClientImpl
java.lang.Object
io.camunda.zeebe.gateway.impl.broker.BrokerClientImpl
- All Implemented Interfaces:
BrokerClient,AutoCloseable
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBrokerClientImpl(Duration requestTimeout, MessagingService messagingService, ClusterMembershipService membershipService, ClusterEventService eventService, ClusterCommunicationService communicationService, ActorSchedulingService schedulingService) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()<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.<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.<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.<T> voidsendRequestWithRetry(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.<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.start()Starts broker client and associated services.voidsubscribeJobAvailableNotification(String topic, Consumer<String> handler)
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG
-
-
Constructor Details
-
BrokerClientImpl
public BrokerClientImpl(Duration requestTimeout, MessagingService messagingService, ClusterMembershipService membershipService, ClusterEventService eventService, ClusterCommunicationService communicationService, ActorSchedulingService schedulingService)
-
-
Method Details
-
start
Description copied from interface:BrokerClientStarts broker client and associated services.- Specified by:
startin interfaceBrokerClient- 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceBrokerClient
-
sendRequest
Description copied from interface:BrokerClientSends a request to the partition if request specifies a partition, otherwise assign a partition send it to it.- Specified by:
sendRequestin interfaceBrokerClient- 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:BrokerClientSends 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:
sendRequestin interfaceBrokerClient- Parameters:
request- request to sendrequestTimeout- 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
Description copied from interface:BrokerClientSends 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:
sendRequestWithRetryin interfaceBrokerClient- 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:BrokerClientSends 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:
sendRequestWithRetryin interfaceBrokerClient- Parameters:
request- request to sendrequestTimeout- 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:BrokerClientSends 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:
sendRequestWithRetryin interfaceBrokerClientresponseConsumer- consumer that will be invoked when a successful response is receivedthrowableConsumer- consumer that will be invoked on errors
-
getTopologyManager
- Specified by:
getTopologyManagerin interfaceBrokerClient
-
subscribeJobAvailableNotification
- Specified by:
subscribeJobAvailableNotificationin interfaceBrokerClient
-