abstract class FlowLogic<out T>
A sub-class of FlowLogic implements a flow using direct, straight line blocking code. Thus you can write complex flow logic in an ordinary fashion, without having to think about callbacks, restarting after a node crash, how many instances of your flow there are running and so on.
Invoking the network will cause the call stack to be suspended onto the heap and then serialized to a database using the Quasar fibers framework. Because of this, if you need access to data that might change over time, you should request it just-in-time via the serviceHub property which is provided. Dont try and keep data you got from a service across calls to send/receive/sendAndReceive because the world might change in arbitrary ways out from underneath you, for instance, if the node is restarted or reconfigured
Additionally, be aware of what data you pin either via the stack or in your FlowLogic implementation. Very large objects or datasets will hurt performance by increasing the amount of data stored in each checkpoint.
If youd like to use another FlowLogic class as a component of your own, construct it on the fly and then pass it to the subFlow method. It will return the result of that flow when it completes.
<init> |
FlowLogic() A sub-class of FlowLogic implements a flow using direct, straight line blocking code. Thus you can write complex flow logic in an ordinary fashion, without having to think about callbacks, restarting after a node crash, how many instances of your flow there are running and so on. |
fsm |
lateinit var fsm: FlowStateMachine<*> Reference to the Fiber instance that is the top level controller for the entire flow. |
logger |
val logger: <ERROR CLASS> This is where you should log things to. |
progressTracker |
open val progressTracker: ProgressTracker? Override this to provide a ProgressTracker. If one is provided and stepped, the framework will do something helpful with the progress reports. If this flow is invoked as a sub-flow of another, then the tracker will be made a child of the current step in the parent. If its null, this flow doesnt track progress. |
serviceHub |
val serviceHub: ServiceHub Provides access to big, heavy classes that may be reconstructed from time to time, e.g. across restarts. It is only available once the flow has started, which means it cannnot be accessed in the constructor. Either access this lazily or from inside call. |
call |
abstract fun call(): T This is where you fill out your business logic. |
getCounterpartyMarker |
open fun getCounterpartyMarker(party: Party): Class<*> Return the marker Class which party has used to register the counterparty flow that is to execute on the other side. The default implementation returns the class object of this FlowLogic, but any Class instance will do as long as the other side registers with it. |
receive |
fun <T : Any> receive(otherParty: Party): UntrustworthyData<T> fun <T : Any> receive(otherParty: Party, receiveType: Class<T>): UntrustworthyData<T> |
send |
fun send(otherParty: Party, payload: Any): Unit |
sendAndReceive |
fun <T : Any> sendAndReceive(otherParty: Party, payload: Any): UntrustworthyData<T> fun <T : Any> sendAndReceive(otherParty: Party, payload: Any, receiveType: Class<T>): UntrustworthyData<T> |
subFlow |
fun <R> subFlow(subLogic: FlowLogic<R>, : Boolean = false): R Invokes the given subflow by simply passing through this FlowLogics reference to the FlowStateMachine and then calling the call method. |
track |
fun track(): <ERROR CLASS><String, <ERROR CLASS><String>>? |
Acceptor |
abstract class Acceptor<T> : FlowLogic<Unit> |
BroadcastTransactionFlow |
class BroadcastTransactionFlow : FlowLogic<Unit> Notify all involved parties about a transaction, including storing a copy. Normally this would be called via FinalityFlow. |
Buyer |
class Buyer : FlowLogic<SignedTransaction> |
CashFlow |
class CashFlow : FlowLogic<CashFlowResult> Initiates a flow that produces an Issue/Move or Exit Cash transaction. |
Client |
class Client : FlowLogic<WithKey> A flow to be used for obtaining a signature from a NotaryService ascertaining the transaction timestamp is correct and none of its inputs have been used in another completed transaction. |
FetchDataFlow |
abstract class FetchDataFlow<T : NamedByHash, in W : Any> : FlowLogic<Result<T>> An abstract flow for fetching typed data from a remote peer. |
FinalityFlow |
class FinalityFlow : FlowLogic<Unit> Finalise a transaction by notarising it, then recording it locally, and then sending it to all involved parties. |
Instigator |
abstract class Instigator<out S : ContractState, T> : FlowLogic<StateAndRef<S>> |
NotifyTransactionHandler |
class NotifyTransactionHandler : FlowLogic<Unit> |
Primary |
abstract class Primary : FlowLogic<SignedTransaction> Abstracted bilateral deal flow participant that initiates communication/handshake. |
ResolveTransactionsFlow |
class ResolveTransactionsFlow : FlowLogic<List<LedgerTransaction>> This flow is used to verify the validity of a transaction by recursively checking the validity of all the dependencies. Once a transaction is checked its inserted into local storage so it can be relayed and wont be checked again. |
RunScheduled |
class RunScheduled : FlowLogic<Unit> |
Secondary |
abstract class Secondary<U> : FlowLogic<SignedTransaction> Abstracted bilateral deal flow participant that is recipient of initial communication. |
Seller |
class Seller : FlowLogic<SignedTransaction> |
Service |
class Service : FlowLogic<Unit> Checks that the timestamp command is valid (if present) and commits the input state, or returns a conflict if any of the input states have been previously committed. |