Interface CoordinatorClient
- All Known Implementing Classes:
NarayanaClient
public interface CoordinatorClient
Abstraction over specific coordinator.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Default coordinator url.static final String
Prefix of headers which should be propagated to the coordinator.static final String
Timeout for synchronous communication with coordinator.static final String
Timeout unit for synchronous communication with coordinator.static final String
URL of the coordinator to be used for orchestrating Long Running Actions. -
Method Summary
Modifier and TypeMethodDescriptioncancel
(URI lraId, PropagatedHeaders headers) Cancel LRA if its active.close
(URI lraId, PropagatedHeaders headers) Close LRA if its active.void
Initialization of the properties provided by LRA client.join
(URI lraId, PropagatedHeaders headers, long timeLimit, Participant participant) Join existing LRA with participant.leave
(URI lraId, PropagatedHeaders headers, Participant participant) Leave LRA.start
(String clientID, PropagatedHeaders headers, long timeout) Ask coordinator to start new LRA and return its id.start
(URI parentLRA, String clientID, PropagatedHeaders headers, long timeout) Ask coordinator to start new LRA and return its id.status
(URI lraId, PropagatedHeaders headers) Return status of specified LRA.
-
Field Details
-
CONF_KEY_COORDINATOR_HEADERS_PROPAGATION_PREFIX
Prefix of headers which should be propagated to the coordinator.- See Also:
-
CONF_KEY_COORDINATOR_URL
URL of the coordinator to be used for orchestrating Long Running Actions.- See Also:
-
CONF_KEY_COORDINATOR_TIMEOUT
Timeout for synchronous communication with coordinator.- See Also:
-
CONF_KEY_COORDINATOR_TIMEOUT_UNIT
Timeout unit for synchronous communication with coordinator. Values of enumTimeUnit
are expected.- See Also:
-
CONF_DEFAULT_COORDINATOR_URL
Default coordinator url.- See Also:
-
-
Method Details
-
init
Initialization of the properties provided by LRA client.- Parameters:
coordinatorUriSupplier
- url of the coordinatortimeout
- general timeout for coordinator callstimeoutUnit
- timeout unit for coordinator calls
-
start
Ask coordinator to start new LRA and return its id.- Parameters:
clientID
- id specifying originating method/resourceheaders
- headers to be propagated to the coordinatortimeout
- after what time should be LRA cancelled automatically- Returns:
- id of the new LRA
-
start
Ask coordinator to start new LRA and return its id.- Parameters:
parentLRA
- in case new LRA should be a child of already existing oneclientID
- id specifying originating method/resourceheaders
- headers to be propagated to the coordinatortimeout
- 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 LRAheaders
- headers to be propagated to the coordinatortimeLimit
- time limit in milliseconds after which should be LRA cancelled, 0 means neverparticipant
- participant metadata with URLs to be called when complete/compensate ...- Returns:
- recovery URI if supported by coordinator or empty
-
cancel
Cancel LRA if its active. Should cause coordinator to compensate its participants.- Parameters:
lraId
- id of the LRA to be cancelledheaders
- headers to be propagated to the coordinator- Returns:
- single future of the cancel call
-
close
Close LRA if its active. Should cause coordinator to complete its participants.- Parameters:
lraId
- id of the LRA to be closedheaders
- headers to be propagated to the coordinator- Returns:
- single future of the cancel call
-
leave
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 participantheaders
- headers to be propagated to the coordinatorparticipant
- participant which will leave- Returns:
- single future of the cancel call
-
status
Return status of specified LRA.- Parameters:
lraId
- id of the queried LRAheaders
- headers to be propagated to the coordinator- Returns:
LRAStatus
of the queried LRA
-