Creating a workflow
A workflow is defined as a class that contains a number of steps using functions, and the workflow state modelled as a separate class.
A workflow can be started by one or more different types of messages. Each time a workflow is started, a new workflow state is created. This state will be available to each of the steps in the workflow, and each step can mutate the state by returning some of its properties.
Creating
Create a workflow state by declaring a class that extends WorkflowState.
The $name
property should be unique among all of your workflows.
Create the workflow definition that extends Workflow, passing it a generic parameter of the workflow state.
By extending this class you'll need to provide aconfigureWorkflow(mapper: WorkflowMapper<TState, TWorkflow>): void
implementation. This mapper is used to configure how messages are dispatched to functions in the workflow.
Lastly register the workflow with the bus configuration on startup.
Last updated