public class WithReferencedStatesFlow<T> extends FlowLogic<T>
Given a flow which uses reference states, the class WithReferencedStatesFlow
will execute the flow as a subFlow.
If the flow fails due to a class NotaryError.Conflict
for a reference state, then WithReferencedStatesFlow will be suspended until the
state refs for the reference states are consumed. In this case, a consumption means that:
the owner of the reference state has updated the state with a valid, notarised transaction
the owner of the reference state has shared the update with the node attempting to run the flow which uses the reference state
The node has successfully committed the transaction updating the reference state (and all the dependencies), and added the updated reference state to the vault.
WARNING: Caution should be taken when using this flow as it facilitates automated re-running of flows which use reference states. The flow using reference states should include checks to ensure that the reference data is reasonable, especially if some economics transaction depends upon it.
public static net.corda.core.flows.WithReferencedStatesFlow.Companion Companion
@JvmOverloads public WithReferencedStatesFlow(@NotNull ProgressTracker progressTracker, @NotNull kotlin.jvm.functions.Function0<? extends net.corda.core.flows.FlowLogic<? extends T>> flowLogicProducer)
Given a flow which uses reference states, the class WithReferencedStatesFlow
will execute the flow as a subFlow.
If the flow fails due to a class NotaryError.Conflict
for a reference state, then WithReferencedStatesFlow will be suspended until the
state refs for the reference states are consumed. In this case, a consumption means that:
the owner of the reference state has updated the state with a valid, notarised transaction
the owner of the reference state has shared the update with the node attempting to run the flow which uses the reference state
The node has successfully committed the transaction updating the reference state (and all the dependencies), and added the updated reference state to the vault.
WARNING: Caution should be taken when using this flow as it facilitates automated re-running of flows which use reference states. The flow using reference states should include checks to ensure that the reference data is reasonable, especially if some economics transaction depends upon it.
progressTracker
- a progress tracker instance.flowLogicProducer
- a lambda which creates the class FlowLogic
instance using reference states. This will be executed at least once.It is recommended a new class FlowLogic
instance be returned each time.class WithReferencedStatesFlow
,
class NotaryError.Conflict
@JvmOverloads public WithReferencedStatesFlow(@NotNull kotlin.jvm.functions.Function0<? extends net.corda.core.flows.FlowLogic<? extends T>> flowLogicProducer)
Given a flow which uses reference states, the class WithReferencedStatesFlow
will execute the flow as a subFlow.
If the flow fails due to a class NotaryError.Conflict
for a reference state, then WithReferencedStatesFlow will be suspended until the
state refs for the reference states are consumed. In this case, a consumption means that:
the owner of the reference state has updated the state with a valid, notarised transaction
the owner of the reference state has shared the update with the node attempting to run the flow which uses the reference state
The node has successfully committed the transaction updating the reference state (and all the dependencies), and added the updated reference state to the vault.
WARNING: Caution should be taken when using this flow as it facilitates automated re-running of flows which use reference states. The flow using reference states should include checks to ensure that the reference data is reasonable, especially if some economics transaction depends upon it.
flowLogicProducer
- a lambda which creates the class FlowLogic
instance using reference states. This will be executed at least once.It is recommended a new class FlowLogic
instance be returned each time.class WithReferencedStatesFlow
,
class NotaryError.Conflict
@Suspendable @NotNull public T call()
This is where you fill out your business logic.
@NotNull public ProgressTracker getProgressTracker()
a progress tracker instance.
@JvmStatic @NotNull public static ProgressTracker tracker()