Kevin
Kevin

Reputation: 31

CORDA events from within workflows

Can CORDA workflow publish events? When workflow completes, a notification needs to be sent out to external entities who are not part of CORDA network. An example could be to send email notifications to some individuals associated with one of the parties. How can this be accomplished with Corda?

Upvotes: 2

Views: 408

Answers (1)

Austin Moothart
Austin Moothart

Reputation: 378

Corda flows are best suited for processing Corda transactions and only transactions due to each flow's asynchronous nature.

Sending notifications as a result of recording a fully signed transaction to the ledger is a common use case and it is best to do this once the vault (database) has been updated. You can easily track changes to the vault by using the trackBy or vaultTrackBy method: https://docs.corda.net/api-vault-query.html (search "trackBy" for usage).

This allows you to have a callback method on the vault observable where you can send notifications outside of the Corda flow. More good reading on trackBy was covered in this blog: https://lankydanblog.com/2018/10/05/starting-flows-with-trackby/

Reference documentation: https://docs.corda.net/api/kotlin/corda/net.corda.core.node.services/-vault-service/track-by.html

Upvotes: 0

Related Questions