Package io.camunda.zeebe.transport
Interface ClientTransport
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
AtomixClientTransportAdapter
-
Method Summary
Modifier and TypeMethodDescriptionActorFuture<org.agrona.DirectBuffer> sendRequest(Supplier<String> nodeAddressSupplier, ClientRequest clientRequest, Duration timeout) Send a request to a node with out any retries.default ActorFuture<org.agrona.DirectBuffer> sendRequestWithRetry(Supplier<String> nodeAddressSupplier, ClientRequest clientRequest, Duration timeout) Similar tosendRequestWithRetry(Supplier, Predicate, ClientRequest, Duration), but no requests are validated before completing the future.ActorFuture<org.agrona.DirectBuffer> sendRequestWithRetry(Supplier<String> nodeAddressSupplier, Predicate<org.agrona.DirectBuffer> responseValidator, ClientRequest clientRequest, Duration timeout) Send a request to a node with retries if there is no current connection or the node is not resolvable.Methods inherited from interface java.lang.AutoCloseable
close
-
Method Details
-
sendRequestWithRetry
default ActorFuture<org.agrona.DirectBuffer> sendRequestWithRetry(Supplier<String> nodeAddressSupplier, ClientRequest clientRequest, Duration timeout) Similar tosendRequestWithRetry(Supplier, Predicate, ClientRequest, Duration), but no requests are validated before completing the future.Send a request to a node with retries if there is no current connection or the node is not resolvable. Makes this method more robust in the presence of short intermittent disconnects.
Guarantees:
- Not garbage-free
- n intermediary copies of the request (one local copy for making retries, one copy on the send buffer per try)
- Parameters:
nodeAddressSupplier- supplier for the node address the retries are executed against (retries may be executed against different nodes). The supplier may resolve tonullto signal that a node address can not be determined. In that case, the request is retried after resubmit timeout.clientRequest- the request which should be sendtimeout- The timeout until the returned future fails if no response is received.- Returns:
- a future carrying the response that was accepted or null in case no memory is currently available to allocate the request. Can complete exceptionally in failure cases such as timeout.
-
sendRequestWithRetry
ActorFuture<org.agrona.DirectBuffer> sendRequestWithRetry(Supplier<String> nodeAddressSupplier, Predicate<org.agrona.DirectBuffer> responseValidator, ClientRequest clientRequest, Duration timeout) Send a request to a node with retries if there is no current connection or the node is not resolvable. Makes this method more robust in the presence of short intermittent disconnects.Guarantees:
- Not garbage-free
- n intermediary copies of the request (one local copy for making retries, one copy on the send buffer per try)
- Parameters:
nodeAddressSupplier- supplier for the node address the retries are executed against (retries may be executed against different nodes). The supplier may resolve tonullto signal that a node address can not be determined. In that case, the request is retried after resubmit timeout.responseValidator- predicate which tests the received response, before completing the future to verify, whether this request needs to be retried or not, in respect of the current timeout. This avoids retrying, without new copy of the corresponding request and no separate logic in the client. When the validator returns *true* then the request is valid and should not be retried.clientRequest- the request which should be sendtimeout- The timeout until the returned future fails if no response is received.- Returns:
- a future carrying the response that was accepted or null in case no memory is currently available to allocate the request. Can complete exceptionally in failure cases such as timeout.
-
sendRequest
ActorFuture<org.agrona.DirectBuffer> sendRequest(Supplier<String> nodeAddressSupplier, ClientRequest clientRequest, Duration timeout) Send a request to a node with out any retries.Guarantees:
- Not garbage-free
- 1 intermediary copies of the request
- Parameters:
nodeAddressSupplier- supplier for the node address the retries are executed against (retries may be executed against different nodes). The supplier may resolve tonullto signal that a node address can not be determined. In that case, the request will be completed with a NoRemoteAddressFoundException.clientRequest- the request which should be sendtimeout- The timeout until the returned future fails if no response is received.- Returns:
- a future carrying the response that was accepted or null in case no memory is currently available to allocate the request. Can complete exceptionally in failure cases such as timeout.
-