Static
disconnectingOnce the app YAML file is deployed to Redis, the activate
function can be
called to enable it for the entire quorum at the same moment.
The approach is to establish the coordinated health of the system through series
of call/response exchanges. Once it is established that the quorum is healthy,
the quorum is instructed to run their engine in no-cache
mode, ensuring
that the Redis backend is consulted for the active app version each time a
call is processed. This ensures that all engines are running the same version
of the app, switching over at the same moment and then enabling cache
mode
to improve performance.
Add a delay for the quorum to reach consensus if traffic is busy, but also consider throttling traffic flow to an acceptable level.
Optional
delay: numberAdd a transition message to the workstream, resuming leg 2 of a paused reentrant activity (e.g., await, worker, hook)
When the app YAML file is ready, the deploy
function can be called.
This function is responsible for merging all referenced YAML source
files and writing the JSON output to the file system and to Redis. It
is also possible to embed the YAML in-line as a string.
The version will not be active until activation is explicitly called.
Returns searchable/queryable data for a job. In this example a literal field is also searched (the colon is used to track job status and is a reserved field; it can be read but not written).
Returns all data (HGETALL) for a job.
Returns the status of a job. This is a numeric
semaphore value that indicates the job's state.
Any non-positive value indicates a completed job.
Jobs with a value of -1
are pending and will
automatically be scrubbed after a set period.
Jobs a value around -1billion have been interrupted
and will be scrubbed after a set period. Jobs with
a value of 0 completed normally. Jobs with a
positive value are still running.
Re/entry point for an active job. This is used to resume a paused job
and close the reentry point or leave it open for subsequent reentry.
Because hooks
are public entry points, they include a topic
which is established in the app YAML file.
When this method is called, a hook rule will be located to establish the exact activity and activity dimension for reentry.
Optional
status: StreamStatusOptional
code: numberInterrupt an active job
Listen to all output and interim emissions of a workflow topic matching a wildcard pattern.
Starts a workflow
Optional
context: JobStateOptional
extended: ExtensionTypePublish a message to the quorum (engine and/or workers)
Request a roll call from the quorum (engine and workers)
Optional
delay: numberSubscribe (listen) to all output and interim emissions of a single workflow topic
Subscribe to quorum events (engine and workers)
Sends a throttle message to the quorum (engine and/or workers)
to limit the rate of processing. Pass -1
to throttle indefinitely.
The value must be a non-negative integer and not exceed MAX_DELAY
ms.
When throttling is set, the quorum will pause for the specified time
before processing the next message. Target specific engines and
workers by passing a guid
and/or topic
. Pass no arguments to
throttle the entire quorum.
In this example, all processing has been paused indefinitely for the entire quorum. This is equivalent to an emergency stop.
HotMesh is a stateless sequence engine, so the throttle can be adjusted up and down with no loss of data.
Unsubscribe from quorum events (engine and workers)
Static
guidStatic
initInstance initializer
Static
stop
This example shows the full lifecycle of a HotMesh engine instance, including: initialization, deployment, activation and execution.
The system is self-cleaning and self-healing, with a built-in quorum for consensus and a worker pool for distributed processing. Workflows are automatically removed from the system once completed.
Example