This sample demonstrates the continueAsNew API. We still need to make these examples more relatable and realistic. If you are planning to write an infinitely long-running Workflow, please get in touch to validate the design and cutoff points.
temporal server start-dev
to start Temporal Server.npm install
to install dependencies.npm run start.watch
to start the Worker.- In another shell,
npm run workflow
to run the Workflow.
In Temporal Web (localhost:8088), you will see 10 Workflows spun out as new Workflows with new event histories and Continuedasnew
status:
Example output:
[loopingWorkflow(loop-0)] Running Workflow iteration: 0
[loopingWorkflow(loop-0)] Running Workflow iteration: 1
[loopingWorkflow(loop-0)] Running Workflow iteration: 2
[loopingWorkflow(loop-0)] Running Workflow iteration: 3
[loopingWorkflow(loop-0)] Running Workflow iteration: 4
[loopingWorkflow(loop-0)] Running Workflow iteration: 5
[loopingWorkflow(loop-0)] Running Workflow iteration: 6
[loopingWorkflow(loop-0)] Running Workflow iteration: 7
[loopingWorkflow(loop-0)] Running Workflow iteration: 8
[loopingWorkflow(loop-0)] Running Workflow iteration: 9