Class NarayanaClient
- java.lang.Object
-
- io.helidon.lra.coordinator.client.narayana.NarayanaClient
-
- All Implemented Interfaces:
CoordinatorClient
public class NarayanaClient extends Object implements CoordinatorClient
Narayana LRA coordinator client.
-
-
Field Summary
-
Fields inherited from interface io.helidon.lra.coordinator.client.CoordinatorClient
CONF_DEFAULT_COORDINATOR_URL, CONF_KEY_COORDINATOR_HEADERS_PROPAGATION_PREFIX, CONF_KEY_COORDINATOR_TIMEOUT, CONF_KEY_COORDINATOR_TIMEOUT_UNIT, CONF_KEY_COORDINATOR_URL
-
-
Constructor Summary
Constructors Constructor Description NarayanaClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Single<Void>
cancel(URI lraId, PropagatedHeaders headers)
Cancel LRA if its active.Single<Void>
close(URI lraId, PropagatedHeaders headers)
Close LRA if its active.void
init(Supplier<URI> coordinatorUriSupplier, long timeout, TimeUnit timeoutUnit)
Initialization of the properties provided by LRA client.Single<Optional<URI>>
join(URI lraId, PropagatedHeaders headers, long timeLimit, Participant p)
Join existing LRA with participant.Single<Void>
leave(URI lraId, PropagatedHeaders headers, Participant p)
Leave LRA.Single<URI>
start(String clientID, PropagatedHeaders headers, long timeout)
Ask coordinator to start new LRA and return its id.Single<URI>
start(URI parentLRAUri, String clientID, PropagatedHeaders headers, long timeout)
Ask coordinator to start new LRA and return its id.Single<LRAStatus>
status(URI lraId, PropagatedHeaders headers)
Return status of specified LRA.
-
-
-
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 interfaceCoordinatorClient
- Parameters:
coordinatorUriSupplier
- url of the coordinatortimeout
- general timeout for coordinator callstimeoutUnit
- 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 interfaceCoordinatorClient
- 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
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 interfaceCoordinatorClient
- Parameters:
parentLRAUri
- 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
-
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 interfaceCoordinatorClient
- Parameters:
lraId
- id of the LRA to be cancelledheaders
- 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 interfaceCoordinatorClient
- Parameters:
lraId
- id of the LRA to be closedheaders
- 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 interfaceCoordinatorClient
- 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 neverp
- 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 interfaceCoordinatorClient
- Parameters:
lraId
- id of the LRA that should be left by supplied participantheaders
- headers to be propagated to the coordinatorp
- participant which will leave- Returns:
- single future of the cancel call
-
status
public Single<LRAStatus> status(URI lraId, PropagatedHeaders headers)
Description copied from interface:CoordinatorClient
Return status of specified LRA.- Specified by:
status
in interfaceCoordinatorClient
- Parameters:
lraId
- id of the queried LRAheaders
- headers to be propagated to the coordinator- Returns:
LRAStatus
of the queried LRA
-
-