Integrant wiring for the jobs module.
Config keys:
:wagoe/jobs The settings block that switches the module on: {:provider :memory | :db | :redis ; default :memory :lease-ms 60000 ; :db only, in-flight lease :redis {:host "localhost" :port 6379} :workers {:count 1 :queue-name :default :virtual-threads? false} :recurring {:nightly-report {:cron "0 2 * * *" :zone "Europe/Amsterdam"}} :scheduler {:tick-ms 5000 :lease-ms 30000 :zone "UTC"} :on-outcome my.app.jobs/on-outcome ; optional, (fn [outcome]) :report-failures-every-ms 3600000 ; error-tracker throttle :expect-success {:nightly-report 26}} ; job type -> hours, else reported
:wagoe/jobs-runtime Queue, store and stats from one adapter, so the three share a backend.
:wagoe/job-queue, :wagoe/job-store, :wagoe/job-stats
What other modules and the devtools dashboard take a ref to — workflow
and push already document :job-queue. Projections of the runtime rather
than components of their own, because the in-memory adapter's queue and
store must share state. :wagoe/job-stats is nil under :provider :db,
which ships no IJobStats.
:wagoe/idempotency-store
IIdempotencyStore on the runtime's backend, for any module.
:wagoe/job-scheduler
The recurring-job ticker: :recurring {job-type {:cron "0 2 * * *" …}}
from the settings block, plus whatever recurring/schedule-recurring!
adds. :scheduler {:tick-ms :lease-ms :zone :watch-ms} tunes it. With
:expect-success its lease holder reports a job type that has not
succeeded within its hours (outcomes/check-stale!).
:wagoe/job-registry
The handler map every module contributed. Modules contribute handlers the
way they contribute routes: a :job-handlers vector in their ig-config,
collected by wagoe.platform.shell.system.config (BOU-330 pattern).
:wagoe/job-workers
The worker pool. :count 0 builds none — that is a web node in the
web/worker split; the default of 1 is a single process that both enqueues
and runs, which is what an application without a deployment topology has.
Each run's outcome goes to the store's IJobOutcomes, :wagoe/metrics,
:wagoe/error-reporting and :on-outcome (wagoe.jobs.shell.outcomes).
:wagoe/job-tenant-runner With the tenant module on: what runs a job that carries a tenant in that tenant's schema. The workers take it; without it such a job fails.
:wagoe/job-dead-letter-retention
The :jobs/dead-letter retention policy, contributed under :retention.
Runs only when :wagoe/privacy :retention names it.
Until BOU-418 this namespace wired none of it: :wagoe/jobs was a settings
passthrough, so java -jar wagoe.jar worker booted and processed nothing.
Integrant wiring for the jobs module.
Config keys:
:wagoe/jobs
The settings block that switches the module on:
{:provider :memory | :db | :redis ; default :memory
:lease-ms 60000 ; :db only, in-flight lease
:redis {:host "localhost" :port 6379}
:workers {:count 1 :queue-name :default :virtual-threads? false}
:recurring {:nightly-report {:cron "0 2 * * *" :zone "Europe/Amsterdam"}}
:scheduler {:tick-ms 5000 :lease-ms 30000 :zone "UTC"}
:on-outcome my.app.jobs/on-outcome ; optional, (fn [outcome])
:report-failures-every-ms 3600000 ; error-tracker throttle
:expect-success {:nightly-report 26}} ; job type -> hours, else reported
:wagoe/jobs-runtime
Queue, store and stats from one adapter, so the three share a backend.
:wagoe/job-queue, :wagoe/job-store, :wagoe/job-stats
What other modules and the devtools dashboard take a ref to — `workflow`
and `push` already document `:job-queue`. Projections of the runtime rather
than components of their own, because the in-memory adapter's queue and
store must share state. `:wagoe/job-stats` is nil under `:provider :db`,
which ships no IJobStats.
:wagoe/idempotency-store
`IIdempotencyStore` on the runtime's backend, for any module.
:wagoe/job-scheduler
The recurring-job ticker: `:recurring {job-type {:cron "0 2 * * *" …}}`
from the settings block, plus whatever `recurring/schedule-recurring!`
adds. `:scheduler {:tick-ms :lease-ms :zone :watch-ms}` tunes it. With
`:expect-success` its lease holder reports a job type that has not
succeeded within its hours (`outcomes/check-stale!`).
:wagoe/job-registry
The handler map every module contributed. Modules contribute handlers the
way they contribute routes: a `:job-handlers` vector in their `ig-config`,
collected by `wagoe.platform.shell.system.config` (BOU-330 pattern).
:wagoe/job-workers
The worker pool. `:count 0` builds none — that is a web node in the
web/worker split; the default of 1 is a single process that both enqueues
and runs, which is what an application without a deployment topology has.
Each run's outcome goes to the store's `IJobOutcomes`, `:wagoe/metrics`,
`:wagoe/error-reporting` and `:on-outcome` (`wagoe.jobs.shell.outcomes`).
:wagoe/job-tenant-runner
With the tenant module on: what runs a job that carries a tenant in that
tenant's schema. The workers take it; without it such a job fails.
:wagoe/job-dead-letter-retention
The `:jobs/dead-letter` retention policy, contributed under `:retention`.
Runs only when `:wagoe/privacy :retention` names it.
Until BOU-418 this namespace wired none of it: `:wagoe/jobs` was a settings
passthrough, so `java -jar wagoe.jar worker` booted and processed nothing.(ig-config settings {:keys [enabled]})This module's Integrant entries, for wagoe.platform.shell.system.config.
:handler-maps is filled in by the application's system config from what the
enabled modules contributed, the way :module-routes is — jobs cannot name
the modules that have handlers any more than the HTTP handler can name the
modules that have routes.
This module's Integrant entries, for `wagoe.platform.shell.system.config`. `:handler-maps` is filled in by the application's system config from what the enabled modules contributed, the way `:module-routes` is — jobs cannot name the modules that have handlers any more than the HTTP handler can name the modules that have routes.
(normalize-provider provider)The provider keyword in the vocabulary cache, realtime, events and jobs
share: :memory | :redis, and :db — which this is the only module to
have, because it is the only one with a database adapter.
Jobs already spelled it this way; :in-memory and :database are accepted
because the other three modules used them, and a user moving between config
blocks should not have to remember which is which (BOU-436).
The provider keyword in the vocabulary cache, realtime, events and jobs share: `:memory` | `:redis`, and `:db` — which this is the only module to have, because it is the only one with a database adapter. Jobs already spelled it this way; `:in-memory` and `:database` are accepted because the other three modules used them, and a user moving between config blocks should not have to remember which is which (BOU-436).
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 |