Story: Custom MQ tables and in-process scheduler
Table of Contents
This page documents a story in Sprint 14. It captures the goal, current status, acceptance criteria, and the tasks that compose it.
Goal
Replace the external pgmq + pg_cron extensions with custom in- process tables + scheduler. Tighter integration with RLS, full control over data structures, unified codebase.
Status
| Field | Value |
|---|---|
| State | DONE |
| Parent sprint | Sprint 14 |
| Now | Completed 2026-03-04. |
| Waiting on | None. |
| Next | None. |
| Last touched | 2026-03-04 |
Continued from: Scheduling subsystem (sprint 13). That story built
ores.scheduler on top of pg_cron; this one replaces the
external pgmq + pg_cron extensions entirely with custom in-process
infrastructure.
Acceptance
- pgmq + pg_cron extensions removed.
- Custom ores_mq_* tables with scope + queue type + RLS.
- In-process scheduler_loop using boost::asio.
- TimescaleDB hypertable for job instance history.
- Protocol 48.0 (breaking).
Tasks
| Task | State | Start | End | Description |
|---|---|---|---|---|
| Replace pgmq + pg_cron with custom tables and scheduler | DONE | 2026-05-20 | 2026-03-04 | Remove pgmq + pg_cron extensions; custom ores_mq_* tables (party / tenant / system scope; task / channel queue types; native RLS); in-process scheduler_loop using boost::asio::steady_timer with sql_action_handler + mq_action_handler; ores_scheduler_job_instances_tbl TimescaleDB hypertable replaces cron.job_run_details; mq_service facade; protocol 48.0 (breaking). |
Decisions
- In-process scheduler over external pg_cron
- we own the action handlers (sql_action_handler + mq_action_handler); RLS-aware by construction.
- Custom MQ tables with scope levels
- party / tenant / system scoping matches the RLS pattern instead of fighting it.
Out of scope
- Inter-process messaging (covered by the NNG → NATS journey later in the sprint).
See also
- Scheduling subsystem (sprint 13) — predecessor (pg_cron-based).
- pgmq queue management and messaging UI — the immediate predecessor in this sprint.