In-memory job queue implementation for development and testing.
Uses Clojure atoms and data structures for job queuing. This adapter is suitable for:
NOT suitable for:
State is stored in atoms with the following structure:
In-memory job queue implementation for development and testing. Uses Clojure atoms and data structures for job queuing. This adapter is suitable for: - Local development without Redis - Fast unit testing - CI/CD pipelines - Learning and tutorials NOT suitable for: - Production use (no persistence, single-process only) - Distributed systems (not shared across processes) - High-volume job processing (limited by memory) State is stored in atoms with the following structure: - jobs: Map of job-id -> job - queues: Map of queue-name -> priority-map of [priority job-ids] - scheduled: Sorted set of [execute-at job-id] pairs - failed: Vector of failed job-ids - stats: Map of queue-name -> statistics
(clear-all-jobs! state)Clear all jobs from state. Useful for testing.
Args: state - InMemoryState instance
Clear all jobs from state. Useful for testing. Args: state - InMemoryState instance
(create-in-memory-job-queue)(create-in-memory-job-queue state)Create in-memory job queue.
Args: state - InMemoryState instance (optional, creates new if not provided)
Returns: InMemoryJobQueue implementing IJobQueue
Create in-memory job queue. Args: state - InMemoryState instance (optional, creates new if not provided) Returns: InMemoryJobQueue implementing IJobQueue
(create-in-memory-job-stats)(create-in-memory-job-stats state)Create in-memory job stats.
Args: state - InMemoryState instance (optional, creates new if not provided)
Returns: InMemoryJobStats implementing IJobStats
Create in-memory job stats. Args: state - InMemoryState instance (optional, creates new if not provided) Returns: InMemoryJobStats implementing IJobStats
(create-in-memory-job-store)(create-in-memory-job-store state)Create in-memory job store.
Args: state - InMemoryState instance (optional, creates new if not provided)
Returns: InMemoryJobStore implementing IJobStore
Create in-memory job store. Args: state - InMemoryState instance (optional, creates new if not provided) Returns: InMemoryJobStore implementing IJobStore
(create-in-memory-jobs-system)Create complete in-memory jobs system with shared state.
Returns: Map with :queue, :store, :stats sharing same state
Create complete in-memory jobs system with shared state. Returns: Map with :queue, :store, :stats sharing same state
(get-all-jobs state)Get all jobs in state. Useful for testing.
Args: state - InMemoryState instance
Returns: Map of job-id -> job
Get all jobs in state. Useful for testing. Args: state - InMemoryState instance Returns: Map of job-id -> job
(get-scheduled-jobs state)Get all scheduled jobs. Useful for testing.
Args: state - InMemoryState instance
Returns: Sorted set of {:execute-at :job-id}
Get all scheduled jobs. Useful for testing.
Args:
state - InMemoryState instance
Returns:
Sorted set of {:execute-at :job-id}(process-scheduled-jobs-internal! queue)Move scheduled jobs that are due to execution queues.
This should be called periodically (e.g., every 5 seconds) by a worker.
Args: queue - InMemoryJobQueue instance
Returns: Number of jobs moved to execution queues
Move scheduled jobs that are due to execution queues. This should be called periodically (e.g., every 5 seconds) by a worker. Args: queue - InMemoryJobQueue instance Returns: Number of jobs moved to execution queues
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 |