Static
executeSpawns a child workflow and awaits the return.
the workflow options
Static
emitEmits an event to the event bus provider (e.g., NATS, Redis, etc.)
The topic name will be structured as follows, prefixed
with the quorum (q) namespace: hmsh:<namespace>:q:
.
For example, if you provide my.dog
as the topic, it will
be published at hmsh:myapp:q:my.dog
.
If using NATS as the pubsub provider, the delimiter
will be .
instead of :
.
If using Postgres, there is a 63 character limit on topic names, so be mindful of the length of the topic. If your topic exceeds 63 characters, it will be hashed by HotMesh to ensure it isn't truncated by Postgres.
Static
enrichConvenience method for adding custom user data to the backend worflow record. Runs exactly once during workflow execution.
Static
execSpawns a child workflow and awaits the return.
the workflow options
Static
getReturns the current workflow context restored from Redis
Static
getStatic
hookSpawns a hook from either the main thread or a hook thread with the provided options; worflowId/TaskQueue/Name are optional and will default to the current workflowId/WorkflowTopic if not provided
the hook options
Static
interruptInterrupts a running job
Static
randomStatic
searchStatic
signalStatic
sleepSleeps the workflow for a duration. As the function is reentrant, upon reentry, the function will traverse prior execution paths up until the sleep command and then resume execution thereafter.
See the ms
package for syntax examples: '1 minute', '2 hours', '3 days'
Static
startSpawns a child workflow and returns the child Job ID. This method guarantees the spawned child has reserved the Job ID, returning a 'DuplicateJobError' error if not. Otherwise, this is a fire-and-forget method.
the workflow options
Static
traceExecutes a trace, outputting the provided attributes to the Open Telemetry sink. Executes exactly once during workflow execution.
It is safe to add this method into any actively running workflow function as long as the trace call would be the last replayable method (by execution order) in the function.
Static
wait
The workflow module provides a set of static extension methods that can be called from within a workflow function. In this example, the
waitFor
extension method is called to add collation to the workflow, only continuing once both outside signals have been received.Example