Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Extending and overriding Flows - Writing a base Responder Flow for extension
@InitiatedBy(SendMessageFlow::class)
open class SendMessageResponder(private val session: FlowSession) : FlowLogic<Unit>() {
open fun postTransactionSigned(transaction: SignedTransaction) {
// to be implemented by sub type flows - otherwise do nothing
}
open fun postTransactionCommitted(transaction: SignedTransaction) {
// to be implemented by sub type flows - otherwise do nothing
}
@Suspendable
final override fun call() {
val stx = subFlow(object : SignTransactionFlow(session) {
override fun checkTransaction(stx: SignedTransaction) {}
})
postTransactionSigned(stx)
val committed = subFlow(
ReceiveFinalityFlow(
otherSideSession = session,
expectedTxId = stx.id
)
)
postTransactionCommitted(committed)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.