corda / net.corda.core.flows / WithReferencedStatesFlow

WithReferencedStatesFlow

class WithReferencedStatesFlow<T : Any> : FlowLogic<T>

Given a flow which uses reference states, the WithReferencedStatesFlow will execute the flow as a subFlow. If the flow fails due to a 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:

  1. the owner of the reference state has updated the state with a valid, notarised transaction
  2. the owner of the reference state has shared the update with the node attempting to run the flow which uses the reference state
  3. 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.

Parameters

progressTracker - a progress tracker instance.

flowLogicProducer - a lambda which creates the FlowLogic instance using reference states. This will be executed at least once. It is recommended a new FlowLogic instance be returned each time.

Types

ATTEMPT

object ATTEMPT : Step

RETRYING

object RETRYING : Step

SUCCESS

object SUCCESS : Step

Constructors

<init>

Given a flow which uses reference states, the WithReferencedStatesFlow will execute the flow as a subFlow. If the flow fails due to a 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:

WithReferencedStatesFlow(progressTracker: ProgressTracker = tracker(), flowLogicProducer: () -> FlowLogic<T>)

Properties

progressTracker

a progress tracker instance.

val progressTracker: ProgressTracker

Functions

call

This is where you fill out your business logic.

fun call(): T

Companion Object Functions

tracker

fun tracker(): ProgressTracker

Extension Functions

receiveAll

Suspends until a message has been received for each session in the specified sessions.

fun FlowLogic<*>.receiveAll(session: Pair<FlowSession, Class<out Any>>, vararg sessions: Pair<FlowSession, Class<out Any>>): Map<FlowSession, UntrustworthyData<Any>>
fun <R : Any> FlowLogic<*>.receiveAll(receiveType: Class<R>, session: FlowSession, vararg sessions: FlowSession): List<UntrustworthyData<R>>
fun <R : Any> FlowLogic<*>.receiveAll(session: FlowSession, vararg sessions: FlowSession): List<UntrustworthyData<R>>