Job execution history: database persistence and in-memory ring buffer.
The ring buffer retains the last N terminal records (completed, failed, partial_success). record-start! writes to the DB only; the terminal record-* functions write to the DB and push to the buffer. observe! adds directly to the buffer without any DB interaction - useful for tests and for wiring up monitoring-event subscribers.
Thread safety: the ring buffer state lives in an atom updated with swap!.
Job execution history: database persistence and in-memory ring buffer. The ring buffer retains the last N terminal records (completed, failed, partial_success). record-start! writes to the DB only; the terminal record-* functions write to the DB and push to the buffer. observe! adds directly to the buffer without any DB interaction - useful for tests and for wiring up monitoring-event subscribers. Thread safety: the ring buffer state lives in an atom updated with swap!.
(create-store pool)(create-store pool config)Creates a history store backed by pool with optional config map. pool may be nil for pure in-memory use (ring buffer only, no DB operations). config keys: :buffer-size (default 1000), :history-retention (default '30 days').
Creates a history store backed by pool with optional config map. pool may be nil for pure in-memory use (ring buffer only, no DB operations). config keys: :buffer-size (default 1000), :history-retention (default '30 days').
(expire! store)Deletes history records whose expires_at has passed. Returns count deleted.
Deletes history records whose expires_at has passed. Returns count deleted.
(get-by-correlation-id store correlation-id)Returns all history records for correlation-id.
Returns all history records for correlation-id.
(get-by-job-id store job-id)Returns all history records for job-id, newest first.
Returns all history records for job-id, newest first.
(observe! store history-record)Adds history-record directly to the ring buffer. No DB interaction. Use for testing, or to wire up monitoring event subscribers.
Adds history-record directly to the ring buffer. No DB interaction. Use for testing, or to wire up monitoring event subscribers.
(query store criteria)Returns history records matching criteria map from the database. Criteria keys (all optional): :from, :to (inst?), :task-identifier, :status, :limit (default 100).
Returns history records matching criteria map from the database. Criteria keys (all optional): :from, :to (inst?), :task-identifier, :status, :limit (default 100).
(recent store)(recent store n)Returns records from the in-memory ring buffer in insertion order. With n, returns the last n records. No DB access.
Returns records from the in-memory ring buffer in insertion order. With n, returns the last n records. No DB access.
(record-completion! store job-id worker-id correlation-id execution-time-ms)Writes job completion to the database and adds the record to the ring buffer. Returns the updated HistoryRecord.
Writes job completion to the database and adds the record to the ring buffer. Returns the updated HistoryRecord.
(record-failure! store job-id worker-id correlation-id execution-time-ms error)Writes job failure to the database and adds the record to the ring buffer. error may be a Throwable or a string. Returns the updated HistoryRecord.
Writes job failure to the database and adds the record to the ring buffer. error may be a Throwable or a string. Returns the updated HistoryRecord.
(record-partial-success! store
job-id
worker-id
correlation-id
execution-time-ms
partial-results)Writes partial success to the database and adds the record to the ring buffer. Returns the updated HistoryRecord.
Writes partial success to the database and adds the record to the ring buffer. Returns the updated HistoryRecord.
(record-start! store job worker-id correlation-id)(record-start! store job worker-id correlation-id opts)Writes job execution start to the database. Does not add to ring buffer. Returns the created HistoryRecord. opts key: :history-retention (interval string).
Writes job execution start to the database. Does not add to ring buffer. Returns the created HistoryRecord. opts key: :history-retention (interval string).
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 |