Class NarayanaClient

    • Constructor Detail

      • NarayanaClient

        public NarayanaClient()
    • Method Detail

      • init

        public void init​(Supplier<URI> coordinatorUriSupplier,
                         long timeout,
                         TimeUnit timeoutUnit)
        Description copied from interface: CoordinatorClient
        Initialization of the properties provided by LRA client.
        Specified by:
        init in interface CoordinatorClient
        Parameters:
        coordinatorUriSupplier - url of the coordinator
        timeout - general timeout for coordinator calls
        timeoutUnit - timeout unit for coordinator calls
      • start

        public Single<URI> start​(String clientID,
                                 PropagatedHeaders headers,
                                 long timeout)
        Description copied from interface: CoordinatorClient
        Ask coordinator to start new LRA and return its id.
        Specified by:
        start in interface CoordinatorClient
        Parameters:
        clientID - id specifying originating method/resource
        headers - headers to be propagated to the coordinator
        timeout - after what time should be LRA cancelled automatically
        Returns:
        id of the new LRA
      • start

        public Single<URI> start​(URI parentLRAUri,
                                 String clientID,
                                 PropagatedHeaders headers,
                                 long timeout)
        Description copied from interface: CoordinatorClient
        Ask coordinator to start new LRA and return its id.
        Specified by:
        start in interface CoordinatorClient
        Parameters:
        parentLRAUri - in case new LRA should be a child of already existing one
        clientID - id specifying originating method/resource
        headers - headers to be propagated to the coordinator
        timeout - after what time should be LRA cancelled automatically
        Returns:
        id of the new LRA
      • cancel

        public Single<Void> cancel​(URI lraId,
                                   PropagatedHeaders headers)
        Description copied from interface: CoordinatorClient
        Cancel LRA if its active. Should cause coordinator to compensate its participants.
        Specified by:
        cancel in interface CoordinatorClient
        Parameters:
        lraId - id of the LRA to be cancelled
        headers - headers to be propagated to the coordinator
        Returns:
        single future of the cancel call
      • close

        public Single<Void> close​(URI lraId,
                                  PropagatedHeaders headers)
        Description copied from interface: CoordinatorClient
        Close LRA if its active. Should cause coordinator to complete its participants.
        Specified by:
        close in interface CoordinatorClient
        Parameters:
        lraId - id of the LRA to be closed
        headers - headers to be propagated to the coordinator
        Returns:
        single future of the cancel call
      • join

        public Single<Optional<URI>> join​(URI lraId,
                                          PropagatedHeaders headers,
                                          long timeLimit,
                                          Participant p)
        Description copied from interface: CoordinatorClient
        Join existing LRA with participant.
        Specified by:
        join in interface CoordinatorClient
        Parameters:
        lraId - id of existing LRA
        headers - headers to be propagated to the coordinator
        timeLimit - time limit in milliseconds after which should be LRA cancelled, 0 means never
        p - participant metadata with URLs to be called when complete/compensate ...
        Returns:
        recovery URI if supported by coordinator or empty
      • leave

        public Single<Void> leave​(URI lraId,
                                  PropagatedHeaders headers,
                                  Participant p)
        Description copied from interface: CoordinatorClient
        Leave LRA. Supplied participant won't be part of specified LRA any more, no compensation or completion will be executed on it.
        Specified by:
        leave in interface CoordinatorClient
        Parameters:
        lraId - id of the LRA that should be left by supplied participant
        headers - headers to be propagated to the coordinator
        p - participant which will leave
        Returns:
        single future of the cancel call