Skip to content

Instantly share code, notes, and snippets.

@lankydan
Created March 2, 2019 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lankydan/3c621b023679ffdc4f139c99e47df816 to your computer and use it in GitHub Desktop.
Save lankydan/3c621b023679ffdc4f139c99e47df816 to your computer and use it in GitHub Desktop.
Extending and overriding Flows - Extending a Responder Flow
@InitiatedBy(SendMessageFlow::class)
class CassandraSendMessageResponder(session: FlowSession) :
SendMessageResponder(session) {
override fun postTransactionSigned(transaction: SignedTransaction) {
val message = transaction.coreTransaction.outputsOfType<MessageState>().single()
logger.info("Signed transaction for message: $message")
}
override fun postTransactionCommitted(transaction: SignedTransaction) {
val message = transaction.coreTransaction.outputsOfType<MessageState>().single()
serviceHub.cordaService(MessageRepository::class.java).save(
message,
sender = false,
committed = true
)
logger.info("Committed transaction for message: $message")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment