Use MVStore persistence

Quarkus Flow MVStore provides workflow restoration capabilities by storing workflow instance state using MVStore

When active, every time a task is completed the workflow status is written into a local filesytem file. When after a server shutdown, the same application (as identified by its application id) is restored in a different Java Virtual machine, all running workflow instances resume execution at the latest recorded point.

Automatic restoration can be disabled by setting quarkus.flow.persistence.autoRestore to false.

Setup

Setup a Quarkus application with Quarkus Flow set up.

Add Quarkus Flow MVStore dependency to your pom.xml

<dependency>
  <groupId>io.quarkiverse.flow</groupId>
  <artifactId>quarkus-flow-mvstore</artifactId>
</dependency>

Add quarkus.flow.persistence.mvstore.db-path property to application.properties.

For example

quarkus.flow.persistence.mvstore.db-path=$HOME/testFlowMVStore.db

Add model marshaler

In order to be able to write and read the workflow model to/from the persistence store, Quarkus Flow requires the presence of an implementation of io.serverlessworkflow.impl.marshaller.CustomObjectMarshaller interface capable of marshaling the workflow model.

By default, the underlying WorkflowModel implementation is based on Jackson, therefore following dependency should be added together with the persistence plug-in one.

<dependency>
  <groupId>io.serverlessworkflow</groupId>
  <artifactId>serverlessworkflow-persistence-jackson-marshaller</artifactId>
</dependency>