Read the full product announcement
New helpers have been added to avoid having to create tasks to manage workflows, debug, and do non-idempotent things by definition - such as getting the current date and time, or using random numbers:
this.log()
to do console.log()
inside a workflow.
this.random()
to get a random float using Math.random()
inside a workflow.
this.date()
to get a Date
object representing the current time inside a workflow.
this.send()
to send an event to the current workflow.
this.terminate()
to terminate the current workflow. Please note that the workflow will appear as terminated and will displayed as a black progress bar, whereas a simple return
in the workflow have the same effect but the workflow appears as completed with a green progress bar. You can use this.terminate()
if you want to quickly being able to distinguish a workflow that was interrupted early in the monitoring.
this.pause()
to pause the current workflow.
this.select
to begin a selection of workflows as the target of an action.
this.select.workflow().withId()
will target a specific workflow by its identifier.this.select.workflow("PaymentWorkflow").withTag("order:1234")
will target workflows named PaymentWorkflows
and having the tag order:1234
associated to them.this.select.workflow("PaymentWorkflow")
will target all workflows named "PaymentWorkflow"
..send()
: Send an event to workflows matching the selector. Example: this.select.workflow().withId("78cb6908-e8f3-4e21-b546-35d5e9fda15e").send("PaymentRejected", "CARD_EXPIRED")
will send event PaymentRejected
to the workflow with identifier 78cb6908-e8f3-4e21-b546-35d5e9fda15e
..terminate()
: Terminate workflows matching the selector. Example: this.select.workflow("PaymentWorkflow").terminate()
will terminate all PaymentWorkflow
workflows..pause()
: Pause workflows matching the selector. Same usage than .terminate()
..resume()
: Resume workflows matching the selector. Same usage than .terminate()
.Client
object. Usage in the same as described above. Example:const { Client } = require("zenaton");
const zenaton = new Client("<app id>", "<api token>", "<app env>");
zenaton.select.workflow("PaymentWorkflow").terminate();
Connectors are now deprecated in favor of a direct usage of 3rd party APIs and SDKs.