Background job worker implementation.
Workers poll job queues, execute jobs, and handle retries. This module provides a production-ready worker with:
Background job worker implementation. Workers poll job queues, execute jobs, and handle retries. This module provides a production-ready worker with: - Graceful shutdown - Configurable polling intervals - Automatic retry handling - Scheduled job processing - Job handler registry - Comprehensive error handling
(create-job-registry)Create a new job handler registry.
Returns: JobRegistry implementing IJobRegistry
Create a new job handler registry. Returns: JobRegistry implementing IJobRegistry
(create-worker config queue store registry)Create and start a background job worker.
Args: config - Worker configuration map with: :queue-name - Queue to process (keyword, required) :poll-interval-ms - Milliseconds between polls (default 1000) :scheduled-interval-ms - Check scheduled jobs interval (default 5000) queue - IJobQueue implementation store - IJobStore implementation registry - IJobRegistry implementation
Returns: Worker implementing IJobWorker
Create and start a background job worker.
Args:
config - Worker configuration map with:
:queue-name - Queue to process (keyword, required)
:poll-interval-ms - Milliseconds between polls (default 1000)
:scheduled-interval-ms - Check scheduled jobs interval (default 5000)
queue - IJobQueue implementation
store - IJobStore implementation
registry - IJobRegistry implementation
Returns:
Worker implementing IJobWorker(create-worker-pool config queue store registry)Create multiple workers for parallel job processing.
Args: config - Worker pool configuration with: :queue-name - Queue to process :worker-count - Number of workers (default 4) :poll-interval-ms - Polling interval :scheduled-interval-ms - Scheduled check interval queue - IJobQueue implementation store - IJobStore implementation registry - IJobRegistry implementation
Returns: Vector of Worker instances
Create multiple workers for parallel job processing.
Args:
config - Worker pool configuration with:
:queue-name - Queue to process
:worker-count - Number of workers (default 4)
:poll-interval-ms - Polling interval
:scheduled-interval-ms - Scheduled check interval
queue - IJobQueue implementation
store - IJobStore implementation
registry - IJobRegistry implementation
Returns:
Vector of Worker instances(stop-worker-pool! workers)Stop all workers in a pool gracefully.
Args: workers - Vector of Worker instances
Stop all workers in a pool gracefully. Args: workers - Vector of Worker instances
(worker-pool-status workers)Get status of all workers in a pool.
Args: workers - Vector of Worker instances
Returns: Vector of worker status maps
Get status of all workers in a pool. Args: workers - Vector of Worker instances Returns: Vector of worker status maps
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 |