Interface CoordinatorClient

  • All Known Implementing Classes:
    NarayanaClient

    public interface CoordinatorClient
    Abstraction over specific coordinator.
    • Field Detail

      • CONF_KEY_COORDINATOR_HEADERS_PROPAGATION_PREFIX

        static final String CONF_KEY_COORDINATOR_HEADERS_PROPAGATION_PREFIX
        Prefix of headers which should be propagated to the coordinator.
        See Also:
        Constant Field Values
      • CONF_KEY_COORDINATOR_URL

        static final String CONF_KEY_COORDINATOR_URL
        URL of the coordinator to be used for orchestrating Long Running Actions.
        See Also:
        Constant Field Values
      • CONF_KEY_COORDINATOR_TIMEOUT

        static final String CONF_KEY_COORDINATOR_TIMEOUT
        Timeout for synchronous communication with coordinator.
        See Also:
        Constant Field Values
      • CONF_KEY_COORDINATOR_TIMEOUT_UNIT

        static final String CONF_KEY_COORDINATOR_TIMEOUT_UNIT
        Timeout unit for synchronous communication with coordinator. Values of enum TimeUnit are expected.
        See Also:
        Constant Field Values
      • CONF_DEFAULT_COORDINATOR_URL

        static final String CONF_DEFAULT_COORDINATOR_URL
        Default coordinator url.
        See Also:
        Constant Field Values
    • Method Detail

      • init

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

        @Deprecated(since="2.4.2",
                    forRemoval=true)
        default Single<URI> start​(String clientID,
                                  long timeout)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Ask coordinator to start new LRA and return its id.
        Parameters:
        clientID - id specifying originating method/resource
        timeout - after what time should be LRA cancelled automatically
        Returns:
        id of the new LRA
      • start

        Single<URI> start​(String clientID,
                          PropagatedHeaders headers,
                          long timeout)
        Ask coordinator to start new LRA and return its id.
        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

        @Deprecated(since="2.4.2",
                    forRemoval=true)
        default Single<URI> start​(URI parentLRA,
                                  String clientID,
                                  long timeout)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Ask coordinator to start new LRA and return its id.
        Parameters:
        parentLRA - in case new LRA should be a child of already existing one
        clientID - id specifying originating method/resource
        timeout - after what time should be LRA cancelled automatically
        Returns:
        id of the new LRA
      • start

        Single<URI> start​(URI parentLRA,
                          String clientID,
                          PropagatedHeaders headers,
                          long timeout)
        Ask coordinator to start new LRA and return its id.
        Parameters:
        parentLRA - 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
      • join

        @Deprecated(since="2.4.2",
                    forRemoval=true)
        default Single<Optional<URI>> join​(URI lraId,
                                           long timeLimit,
                                           Participant participant)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Join existing LRA with participant.
        Parameters:
        lraId - id of existing LRA
        timeLimit - time limit in milliseconds after which should be LRA cancelled, 0 means never
        participant - participant metadata with URLs to be called when complete/compensate ...
        Returns:
        recovery URI if supported by coordinator or empty
      • join

        Single<Optional<URI>> join​(URI lraId,
                                   PropagatedHeaders headers,
                                   long timeLimit,
                                   Participant participant)
        Join existing LRA with participant.
        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
        participant - participant metadata with URLs to be called when complete/compensate ...
        Returns:
        recovery URI if supported by coordinator or empty
      • cancel

        @Deprecated(since="2.4.2",
                    forRemoval=true)
        default Single<Void> cancel​(URI lraId)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Cancel LRA if its active. Should cause coordinator to compensate its participants.
        Parameters:
        lraId - id of the LRA to be cancelled
        Returns:
        single future of the cancel call
      • cancel

        Single<Void> cancel​(URI lraId,
                            PropagatedHeaders headers)
        Cancel LRA if its active. Should cause coordinator to compensate its participants.
        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

        @Deprecated(since="2.4.2",
                    forRemoval=true)
        default Single<Void> close​(URI lraId)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Close LRA if its active. Should cause coordinator to complete its participants.
        Parameters:
        lraId - id of the LRA to be closed
        Returns:
        single future of the cancel call
      • close

        Single<Void> close​(URI lraId,
                           PropagatedHeaders headers)
        Close LRA if its active. Should cause coordinator to complete its participants.
        Parameters:
        lraId - id of the LRA to be closed
        headers - headers to be propagated to the coordinator
        Returns:
        single future of the cancel call
      • leave

        @Deprecated(since="2.4.2",
                    forRemoval=true)
        default Single<Void> leave​(URI lraId,
                                   Participant participant)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Leave LRA. Supplied participant won't be part of specified LRA any more, no compensation or completion will be executed on it.
        Parameters:
        lraId - id of the LRA that should be left by supplied participant
        participant - participant which will leave
        Returns:
        single future of the cancel call
      • leave

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

        Single<LRAStatus> status​(URI lraId,
                                 PropagatedHeaders headers)
        Return status of specified LRA.
        Parameters:
        lraId - id of the queried LRA
        headers - headers to be propagated to the coordinator
        Returns:
        LRAStatus of the queried LRA