March 30, 2020
In the latest release of Corda open source v4.4, we introduced a feature to monitor the lifecycle of Corda service.
Corda services are long-lived instances that can trigger or be triggered by flows from within a node. A service class is limited to a single instance per node. They allow related, reusable, functions to be separated into their own class where their functionality is grouped together.
You can find simple demo at this autopayroll-CordaService sample.
With the flexibilities of the Corda service, we are starting to see more and more use of it. However, we have also experienced some incidences, when the service is “upset”. For example:
In these critical conditions, it makes it impossible for service to function going forward.
Upon instantiation of the Corda service:
This code will register to the node’s service hub and monitored by the life cycle observer.
Now, when any service feels that it cannot continue, it may throw
CordaServiceCriticalFailureException from lifecycle handler which will lead to node terminating JVM. This fail-fast approach will let the node operator spot the service failure explicitly, which will lead to minimizing the later operation cost.
We’d love to hear about your experiences and answer any questions you have in our public slack channel: http://slack.corda.net/.
Share this post
Stay up to date on the latest news and articles related to Corda.