Package io.zeebe.transport.impl
Class AtomixClientTransportAdapter
- java.lang.Object
-
- io.zeebe.util.sched.Actor
-
- io.zeebe.transport.impl.AtomixClientTransportAdapter
-
- All Implemented Interfaces:
ClientTransport
,CloseableSilently
,AsyncClosable
,AutoCloseable
public final class AtomixClientTransportAdapter extends Actor implements ClientTransport
-
-
Constructor Summary
Constructors Constructor Description AtomixClientTransportAdapter(MessagingService messagingService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ActorFuture<org.agrona.DirectBuffer>
sendRequest(Supplier<String> nodeAddressSupplier, ClientRequest clientRequest, Duration timeout)
Send a request to a node with out any retries.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 class io.zeebe.util.sched.Actor
buildActorName, close, closeAsync, getName, handleFailure, isActorClosed, onActorClosed, onActorCloseRequested, onActorClosing, onActorFailed, onActorStarted, onActorStarting, wrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.zeebe.transport.ClientTransport
sendRequestWithRetry
-
-
-
-
Constructor Detail
-
AtomixClientTransportAdapter
public AtomixClientTransportAdapter(MessagingService messagingService)
-
-
Method Detail
-
sendRequestWithRetry
public ActorFuture<org.agrona.DirectBuffer> sendRequestWithRetry(Supplier<String> nodeAddressSupplier, Predicate<org.agrona.DirectBuffer> responseValidator, ClientRequest clientRequest, Duration timeout)
Description copied from interface:ClientTransport
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)
- Specified by:
sendRequestWithRetry
in interfaceClientTransport
- Parameters:
nodeAddressSupplier
- supplier for the node address the retries are executed against (retries may be executed against different nodes). The supplier may resolve tonull
to 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
public ActorFuture<org.agrona.DirectBuffer> sendRequest(Supplier<String> nodeAddressSupplier, ClientRequest clientRequest, Duration timeout)
Description copied from interface:ClientTransport
Send a request to a node with out any retries.Guarantees:
- Not garbage-free
- 1 intermediary copies of the request
- Specified by:
sendRequest
in interfaceClientTransport
- Parameters:
nodeAddressSupplier
- supplier for the node address the retries are executed against (retries may be executed against different nodes). The supplier may resolve tonull
to 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.
-
-