Kathikon documentation

Copy Markdown View Source

Kathikon (καθήκον — duty, obligation) is a BEAM-native durable job queue for Elixir. Jobs are persisted in Mnesia, executed by OTP supervisors and dispatchers, and tracked through an explicit state machine.

Current release: v0.2.0 — control, scheduling, batches, and correctness

Guides

Start here if you are new to the library:

GuideWhat you will learn
Quick startInstall, configure, define a worker, enqueue your first job
WorkersThe Kathikon.Worker behaviour, return values, errors
Queues & concurrencyMultiple queues, dispatcher concurrency, isolation
Schedulingschedule_in, schedule_at, cron, scheduler promotion
Retries & errorsBackoff, max_attempts, dead-letter, error recording
CancellationWhen jobs can be cancelled, API usage
TelemetryEvents, measurements, metadata, custom handlers
ConfigurationAll config :kathikon keys and environments
Storage & embeddingMnesia setup, Livebook, tests, backends

v0.2.0 topics

DocumentContents
StorageStorage behaviour, Mnesia tables, lifecycle
Job lifecycleState machine and history events
SchedulingOne-time and recurring schedules, timezone
BatchesFan-out/fan-in parent/child workflows
Management APIClaim, retry, dead-letter, queue control
ReportingQueue and failure summaries
Quantum adapterOptional Quantum scheduler integration
ArchitectureSupervision tree and runtime components

Reference

DocumentContents
Module referenceEvery module and public function with examples
Interactive demoLivebook walkthrough

Examples

Runnable scripts in examples/ at the project root — run with mix run examples/<name>.exs:

ScriptDemonstrates
examples/basic_worker.exsInsert and poll status
examples/scheduled_job.exsschedule with :at / :in
examples/dead_letter_retry.exsFailures, dead letter, rerun
examples/batch_fanout_fanin.exsParent/child batches
examples/reporting.exsKathikon.Report summaries
examples/quantum_scheduler_adapter.exsOptional Quantum scheduler

Architecture at a glance

Kathikon.Supervisor
 Registry
 Kathikon.Queue          (DynamicSupervisor  one Dispatcher per queue)
 Kathikon.QueueControl
 Kathikon.Scheduler.Promoter   (promotes :scheduled  :available)
 Kathikon.Scheduler.BuiltIn.Tick   (cron evaluation, optional)
 Kathikon.Pruner         (deletes terminal jobs after retention)

Public API: Kathikon.insert/3, Kathikon.schedule/3, Kathikon.cancel/1, Kathikon.fetch/1, Kathikon.status/1, Kathikon.history/1, Kathikon.all/0, Kathikon.start_queue/1, Kathikon.claim/2, Kathikon.retry/2, Kathikon.dead_jobs/1.