Your First Flow
The MyFirstFlow
and MyFirstResponderFlow
flows are basic flows that illustrate the main features of Corda 5 flows.
Many of the features will be familiar to those Developers who have written Corda 4 CorDapps
Corda Distributed Application. A Java (or any JVM targeting language) application built using the Corda build toolchain and CorDapp API to solve some problem that is best solved in a decentralized manner.
. However, there are some important differences when using Corda 5:
- Services are injected on an as-needed basis.
- Flows are started via a REST endpoint, rather than a Java client sending Java classes over AMQP.
- Initiating and responder flows are linked with a protocol rather than class names.
- Singletons should be avoided in flow code because there is no guarantee that the same flow worker A worker that runs the CorDapp application code and translates flow API calls into function requests to the relevant workers. The flow workers are designed to share work between themselves and to record checkpoints at each stage of the application's progress, so that in the event of worker failure, the operations can be retried. will continue to execute a flow after it has been check-pointed and restarted.
MyFirstFlow Use Case
The use case in the example flows is very simple:
- The initiating flow is called on the initiating node with another member of the application network The set of all possible entities onboarded according to the rules of the network. Application networks enable people and businesses to interact with each other on Corda. , the recipient, specified as the input argument.
- The initiating flow sends the message
Hello from <initiator>.
to the specified recipient. - The responder flow receives the message and replies with
Hello <initiator>, best wishes from <responder>.
. - The initiator returns the message received from the responder as a String.
MyFirstFlow Code
The following sections describe the flow code in more detail:
Was this page helpful?
Thanks for your feedback!
Chat with us
Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.
Propose documentation improvements directly
Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.
We're sorry this page wasn't helpful. Let us know how we can make it better!
Chat with us
Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.
Create an issue
Create a new GitHub issue in this repository - submit technical feedback, draw attention to a potential documentation bug, or share ideas for improvement and general feedback.
Propose documentation improvements directly
Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.