Claim, Deliver and Record Scheduled Work
What It Does
Accounting coordinates recurring timing through schedule rows, one dispatcher and a queue consumer. The dispatcher chooses the latest due occurrence and can skip older backlog. Registered work covers recurring rolls, automatic close, Reconciliation sweeps and recurring Billing preparation. History records execution results and pause reasons.
The Flow
When Something Fails
Claim rollback leaves timing due. Explicit publish refusals are released, but an interruption between claim and publication can leave an offered run without delivery. Terminal work is acknowledged; unfinished work may execute again, including concurrently on duplicate delivery. Expected refusals settle immediately, while unexpected errors retry. On the final receive the consumer records failure and acknowledges it; malformed messages and failures that cannot be recorded can reach the dead-letter queue.
The scheduler does not compensate handler effects. Failure counts pause an enabled schedule after five recorded failures, with no attention notice. An invalid saved definition also pauses. Handler repeat safety and recovery of a closed unposted batch remain the owning module’s concerns.
Open Design Questions
Implementation preparation needs a delivery-recovery decision for stranded claims and an explicit idempotency contract for each handler. Billing’s scheduling ownership and pause notification also remain open.