Zenaton white logo

Workflow versioning

For Running Instances

Trying to update a workflow implementation while some instances are running will trigger a Zenaton\Exceptions\ModifiedDeciderExceptionModifiedDeciderExceptionModifiedDeciderExceptionModifiedDeciderExceptionpanic. This is because Zenaton has currently no way to know how to use an updated implementation to continue execution of already running workflow instances.

Zenaton lets you easily update a workflow as described below, but keep in mind your modifications will apply only to new instances.

For New Instances

Let's assume you currently have a MyWorkflow class. As you will have different versions running, you MUST version your sources. This is how to do it:

  • rename your existing class MyWorkflow to MyWorkflow_v0
  • create your new version MyWorkflow_v1
  • create a new MyWorkflow class extending provided Zenaton\Workflows\Version class
use Zenaton\Workflows\Version;

class MyWorkflow extends Version
    public function versions()
        return [
  • create a new MyWorkflow class with provided Version function
const { Version } = require("zenaton");
const MyWorkflow_v0 = require("./MyWorkflow_v0");
const MyWorkflow_v1 = require("./MyWorkflow_v1");

module.exports = Version("MyWorkflow", [
  • create a new MyWorkflow class inheriting from the provided Zenaton::Workflows::Version super class
require 'zenaton'
require './my_workflow_v0'
require './my_workflow_v1'

class MyWorkflow < Zenaton::Workflows::Version
  def versions
  • create a new MyWorkflow class inheriting from the provided Zenaton.workflows.version.Version super class
from zenaton.workflows.version import Version
from .version_workflow_v0 import VersionWorkflowV0
from .version_workflow_v1 import VersionWorkflowV1

class MyWorkflow(Version):

    def versions(self):
        return [
  • create a new MyWorkflow workflow with the provided Version function
import "github.com/zenaton/zenaton-go/v1/zenaton/workflow"
var MyWorkflow = workflow.Version("MyWorkflow", []*workflow.Definition{

That's all you need! that, if you write another version MyWorkflow_v2, you just have to add it to your sources and add it to MyWorkflow.

You do NOT have to change the implementation of your client that will still use MyWorkflow class (eg. to launch a workflow, you will still use (new MyWorkflow(...))->dispatch()await new MyWorkflow(...).dispatch()MyWorkflow.new(...).dispatchMyWorkflow(...).dispatch()MyWorkflow.New(...).Dispatch() ).

The _v convention is only a suggestion. You can decide on a different naming convention.