A minimalist job queue worker for SQL. This assumes
multiple worker off of a main job queue. In the following
code, each worker is assumed to be able to process both
actions and workflow evaluation. The processing is based off
of two tables: task
and workflow_run
. workflow_run
holds
information about a full workflow run and its current status,
while task
is used for both calls to job/restart
and action
dispatches.
A minimalist job queue worker for SQL. This assumes multiple worker off of a main job queue. In the following code, each worker is assumed to be able to process both actions and workflow evaluation. The processing is based off of two tables: `task` and `workflow_run`. `workflow_run` holds information about a full workflow run and its current status, while `task` is used for both calls to `job/restart` and action dispatches.
(retry db jobstore wid)
Retries a given job by its id. If the job is in a replayable state, it will register a job entry for restarting the job.
Returns true
if the job is retryable, false
otherwise.
Will throw an exception if the job is has not terminated.
The processing should be done by a worker
thread.
Retries a given job by its id. If the job is in a replayable state, it will register a job entry for restarting the job. Returns `true` if the job is retryable, `false` otherwise. Will throw an exception if the job is has not terminated. The processing should be done by a `worker` thread.
(submit
db
jobstore
job
{:keys [context type system uuid owner metadata]
:or
{context {} metadata {} owner "unknown" type "unknown" system "unknown"}})
Create a new job to be processed. Only registers the job entry, no
processing will be performed unless at least one separate thread
concurrently runs worker
.
Create a new job to be processed. Only registers the job entry, no processing will be performed unless at least one separate thread concurrently runs `worker`.
(worker db
jobstore
{:keys [action-fn error-handler]}
wait-ms
wait-allowance
stop-fn)
Until stop-fn
returns true, process items until the queue is
exhausted, then wait for a random amount of time (between wait-ms
and wait-ms
+ wait-allowance
).
If stop-fn
throws, the worker will exit.
If error-handler
is supplied, it will be called with the caught exception.
If the error handler (re)throws, the worker will stop processing and quit.
As many worker threads as necessary can be started on a single host.
Until `stop-fn` returns true, process items until the queue is exhausted, then wait for a random amount of time (between `wait-ms` and `wait-ms` + `wait-allowance`). If `stop-fn` throws, the worker will exit. If `error-handler` is supplied, it will be called with the caught exception. If the error handler (re)throws, the worker will stop processing and quit. As many worker threads as necessary can be started on a single host.
(workflow-by-uuid tx uuid)
Fetch workflow from the database by UUID and restore stored job data to a usable form.
Fetch workflow from the database by UUID and restore stored job data to a usable form.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close