Class AtomixClientTransportAdapter

    • 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 interface ClientTransport
        Parameters:
        nodeAddressSupplier - supplier for the node address the retries are executed against (retries may be executed against different nodes). The supplier may resolve to null 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 send
        timeout - 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 interface ClientTransport
        Parameters:
        nodeAddressSupplier - supplier for the node address the retries are executed against (retries may be executed against different nodes). The supplier may resolve to null 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 send
        timeout - 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.