Events and scheduler
Two cross-cutting foundations serve all the business components: the event journal, which tells what happened, and the scheduler, which does what must be done in the background. Both live in the database, survive a restart and work with several gateways.
The event journal
Section titled “The event journal”- Same transaction: the event is written with the business change (outbox). No lost event, no ghost event; a declined operation writes nothing more than its decision, a replayed network message does not write a second one.
- Emission points: authorization decision, each step of the issuer state machine (portal, network, clearing, expiries, disputes), cards, files, transfers, disputes, manufacturing, accounting, security.
- Content: the object after the change, read in the same transaction; the correlation (the operation), the causation, the actor and the origin.
- Catalogue: a type missing from the catalogue cannot be emitted; the webhooks offer exactly this catalogue. See Events.
| Relay | How it works |
|---|---|
| Webhook fan-out (every second) | One delivery per subscription; signed POST; 6 attempts at most, increasing delay |
| Kafka publishing (every second) | One topic per object type, key = the object (order kept per object); on failure, spaced retry, the next events of the same object wait |
| Purge (every night) | Events published and fanned out more than 30 days ago |
The two relays are independent: a Kafka outage does not delay the webhooks. The journal is partitioned by month.
The scheduler
Section titled “The scheduler”A scheduler in the database, with no external tool: traceable, surviving a restart, safe with several gateways.
| Element | Content |
|---|---|
| Job | Code, trigger (calendar with time zone, interval, manual), parameters, allowed time window, maximum duration, retries (attempts, increasing delay), active or suspended |
| Run | Origin (calendar, manual), due time, status (queued, running, succeeded, failed, retrying, abandoned, cancelled), attempt, lease, result |
- One due time = one run: unique key (job, due time); a slow job does not pile up; due times missed during an outage are not caught up.
- Lease: the run takes a lease (45 s), renewed every 15 s; a stopped gateway lets its lease expire, the run is seen as failed then retried.
- One run in progress per job, on the whole platform.
- Abandon: after the last retry, the run is abandoned, flagged in the portal and counted.
| Example jobs | Pace |
|---|---|
| Event fan-out, Kafka publishing | every second |
| Sending due webhooks | every 2 s |
| File integration | every 5 s |
| Posting | every 15 s |
| Reporting totals (last 3 days) | every 5 min |
| Hold expiry, dispute deadlines | every 10 min |
| Accounting close and report, authorization journal | every night |
| Secret rotation, partitions ahead, purges | every night |

