Unified entry point that wires all skivi components into a single system map.
Typical usage:
(def system (-> (skivi/create-system config {"send-email" handle-send-email}) (skivi/start!)))
(skivi/add-job system "send-email" {:to "x@y.com"})
;; On shutdown (skivi/stop! system)
Unified entry point that wires all skivi components into a single system map.
Typical usage:
(def system
(-> (skivi/create-system config {"send-email" handle-send-email})
(skivi/start!)))
(skivi/add-job system "send-email" {:to "x@y.com"})
;; On shutdown
(skivi/stop! system)(add-job system task-identifier payload)(add-job system task-identifier payload opts)Validates payload and enqueues a single job. Returns the created job.
Validates payload and enqueues a single job. Returns the created job.
(add-jobs system job-specs)Validates all payloads and enqueues multiple jobs atomically. Returns created jobs.
Validates all payloads and enqueues multiple jobs atomically. Returns created jobs.
(create-system config)(create-system config task-registry)(create-system config task-registry crontabs)Creates a system map from config, task-registry, and optional crontabs. Does not start any background processes - call start! to begin processing.
If config contains [:worker :task-directory], Clojure files there are loaded at startup and merged with task-registry. The programmatic task-registry wins on identifier conflicts.
config - validated Config map (see config/load-config) task-registry - map of task-identifier string to handler fn crontabs - vector of CrontabEntry maps (see scheduler/create-scheduler)
Creates a system map from config, task-registry, and optional crontabs. Does not start any background processes - call start! to begin processing. If config contains [:worker :task-directory], Clojure files there are loaded at startup and merged with task-registry. The programmatic task-registry wins on identifier conflicts. config - validated Config map (see config/load-config) task-registry - map of task-identifier string to handler fn crontabs - vector of CrontabEntry maps (see scheduler/create-scheduler)
(emitter-stats system)Returns a snapshot of monitoring emitter metrics.
Returns a snapshot of monitoring emitter metrics.
(force-unlock-jobs system)(force-unlock-jobs system worker-ids)Clears locks on locked jobs. With no worker-ids, unlocks all locked jobs.
Clears locks on locked jobs. With no worker-ids, unlocks all locked jobs.
(force-unlock-queues system)(force-unlock-queues system queue-names)Clears locks on named job queues. With no queue-names, unlocks all locked queues.
Clears locks on named job queues. With no queue-names, unlocks all locked queues.
(health-check system)Returns true if the database is accessible, false otherwise.
Returns true if the database is accessible, false otherwise.
(load-task-registry task-directory)(load-task-registry task-directory file-extensions)Loads task handlers from Clojure files in task-directory. Each file must evaluate to a {"task-id" handler-fn} map as its last expression. file-extensions is a sequence of file suffixes to include (default: [".clj"]). Returns a merged registry map; files are processed in alphabetical order.
Loads task handlers from Clojure files in task-directory.
Each file must evaluate to a {"task-id" handler-fn} map as its last expression.
file-extensions is a sequence of file suffixes to include (default: [".clj"]).
Returns a merged registry map; files are processed in alphabetical order.(maintenance-stats system)Returns a snapshot of maintenance scheduler metrics, or nil if disabled.
Returns a snapshot of maintenance scheduler metrics, or nil if disabled.
(permanently-fail-jobs system job-ids reason)Sets jobs to exhausted status with reason as last-error.
Sets jobs to exhausted status with reason as last-error.
(query-history system criteria)Returns history records matching criteria map from the database. Criteria keys (all optional): :from, :to, :task-identifier, :status, :limit.
Returns history records matching criteria map from the database. Criteria keys (all optional): :from, :to, :task-identifier, :status, :limit.
(recent-history system)(recent-history system n)Returns recent job execution records from the in-memory ring buffer. With n, returns the last n records. No database access.
Returns recent job execution records from the in-memory ring buffer. With n, returns the last n records. No database access.
(register-rate-limit system key capacity interval)Registers or updates a rate limit. capacity is max tokens per interval. interval is a SQL interval string (e.g. "1 minute").
Registers or updates a rate limit. capacity is max tokens per interval. interval is a SQL interval string (e.g. "1 minute").
(replay-failed-jobs system criteria)Creates new jobs from failed history records matching criteria map.
Creates new jobs from failed history records matching criteria map.
(reschedule-jobs system job-ids opts)Updates run-at, priority, or max-attempts for job-ids. Returns updated jobs.
Updates run-at, priority, or max-attempts for job-ids. Returns updated jobs.
(scheduler-stats system)Returns a snapshot of scheduler operational metrics, or nil if no scheduler.
Returns a snapshot of scheduler operational metrics, or nil if no scheduler.
(start! system)(start! system opts)Runs pending migrations unless :migrate? is false, then starts the worker pool and scheduler (when present). Returns system.
opts keys: :migrate? (default true)
Runs pending migrations unless :migrate? is false, then starts the worker pool and scheduler (when present). Returns system. opts keys: :migrate? (default true)
(stop! system)(stop! system opts)Gracefully stops maintenance, scheduler, worker pool, and closes the connection pool. Returns system.
opts keys: :maintenance-timeout-ms (default 5000), :scheduler-timeout-ms (default 5000), :worker-timeout-ms (default 15000)
Gracefully stops maintenance, scheduler, worker pool, and closes the connection pool.
Returns system.
opts keys: :maintenance-timeout-ms (default 5000), :scheduler-timeout-ms (default 5000),
:worker-timeout-ms (default 15000)(worker-pool-stats system)Returns a snapshot of worker pool operational metrics.
Returns a snapshot of worker pool operational metrics.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |