In-process job buffer with background polling from job-manager.
Jobs are claimed from the database in batches and held in a LinkedBlockingQueue until a worker calls take-job!. The poll loop runs as a daemon thread and automatically refetches when the buffer depth drops below the configured threshold.
In-process job buffer with background polling from job-manager. Jobs are claimed from the database in batches and held in a LinkedBlockingQueue until a worker calls take-job!. The poll loop runs as a daemon thread and automatically refetches when the buffer depth drops below the configured threshold.
(create-queue job-system worker-id)(create-queue job-system worker-id config)Creates a local queue. Call start! to begin polling. worker-id is used for all job claims from this queue.
Creates a local queue. Call start! to begin polling. worker-id is used for all job claims from this queue.
(depth queue)Returns the number of jobs currently buffered locally.
Returns the number of jobs currently buffered locally.
(offer-jobs! queue jobs)Places jobs directly into the buffer without claiming them from the database. Useful for re-dispatch or testing.
Places jobs directly into the buffer without claiming them from the database. Useful for re-dispatch or testing.
(running? queue)Returns true if the background polling loop is active.
Returns true if the background polling loop is active.
(start! queue)Starts the background polling loop. Throws if already running.
Starts the background polling loop. Throws if already running.
(stats queue)Returns a snapshot of queue operational metrics.
Returns a snapshot of queue operational metrics.
(stop! queue)(stop! queue join-timeout-ms)Stops polling, waits for the thread, and drains the buffer. Returns a vector of jobs that were buffered but not dispatched.
Stops polling, waits for the thread, and drains the buffer. Returns a vector of jobs that were buffered but not dispatched.
(take-job! queue timeout-ms)Blocks until a job is available or timeout-ms elapses. Entries older than config :ttl-ms are discarded silently. Returns the job map or nil on timeout.
Blocks until a job is available or timeout-ms elapses. Entries older than config :ttl-ms are discarded silently. Returns the job map or nil on timeout.
(worker-id queue)Returns the worker-id used for database job locking.
Returns the worker-id used for database job locking.
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 |