Interface CoordinatorClient

All Known Implementing Classes:
NarayanaClient

public interface CoordinatorClient
Abstraction over specific coordinator.
  • Field Details

    • 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:
    • 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:
    • CONF_KEY_COORDINATOR_TIMEOUT

      static final String CONF_KEY_COORDINATOR_TIMEOUT
      Timeout for synchronous communication with coordinator.
      See Also:
    • 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:
    • CONF_DEFAULT_COORDINATOR_URL

      static final String CONF_DEFAULT_COORDINATOR_URL
      Default coordinator url.
      See Also:
  • Method Details

    • 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

      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

      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

      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

      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

      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

      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