Architecture / Decision records / ADR-HIS-063
ADR-HIS-063 The event backbone unit: a publication gate, a broker abstraction with two implementations, and an archive for counts and replay¶
| Status | Accepted |
| Decided | 2026-11-25 by session RC-1-S13 |
| Record | Drafted 2026-11-25; approved 2026-11-30 by the Enterprise Architecture Board |
| Where the rule lives | platform/event-backbone/ (its README.md; module mod-ise-004, the topic register mod-ise-004/src/main/resources/backbone/topic-register.yaml, migrations db/mod_ise_004/) |
Context¶
FR-ISE-EVT-001 and FR-ISE-EVT-002 ask the backbone itself to reject an event whose envelope is incomplete or whose payload breaks its registered schema, to refuse publication by anyone but the topic's owner, to be replaceable without changing what an event means, to dead-letter per subscription, to replay under control, and to count per subscription, event type, facility and day. Card RC-1-S13 builds the unit platform/event-backbone.
Apache Kafka, the selected broker (ADR-HIS-007), validates neither envelopes nor schemas at the broker, and cannot tell how many events of a type and facility a consumer acknowledged. The service kit (ADR-HIS-044) already gives every unit a transactional outbox, an idempotent and ordered inbox with bounded retries and a dead-letter topic per subscription, all behind its EventTransport. Workloads do not authenticate to the broker yet (no SASL or mTLS in the environments; trust anchors are FR-ISE-KEY-003, a later slice).
Options considered¶
- Where publication is checked: in each producer's kit (the producer checks itself); after the fact, by a consumer that flags bad events; or by a gate that alone writes the domain topics.
- Broker independence: the kit's interface alone; or an abstraction with a second, working implementation and a migration between them.
- Counts and replay from a retained position: from the broker (consumer offsets and offset-for-time); or from an archive the backbone keeps of every event.
- How a replay reaches one subscription: reset the consumer group's offsets; a redelivery topic per subscription, which every consumer would also read; or the original records sent again to the topic, relying on the consumers' inbox.
Decision¶
- The publication gate. A producer's relay writes each event to
<topic>.ingress. The gate reads every ingress, checks the envelope ofcontracts/common, the causation identifier (FR-ISE-EVT-002 behaviour 1 makes it mandatory), the registration of type and version on the topic, the owner and source, the contract's scope and sequencing rules, time integrity, and the payload against its schema, then forwards the event unchanged, with the same key, to the topic. Only the gate writes a domain topic. A refused event is recorded, returned on<topic>.rejectedwith its reasons, and, for a producer that is not who it says, audited asise.service-identity.denied. Each ingress partition is handled in order, so the order of a key is kept. The producer is checked against what the event claims (its envelope producer and source). Until workloads authenticate (FR-ISE-KEY-003), any workload that can write an ingress can claim to be the owner. Broker ACLs that let each workload write only the ingress of its own topics, and the gate's check of the authenticated workload, close that. - The topic register (
topic-register.yaml, DE-ISE-009) names, per topic, the owning workload, classification, tier, retention (CFG-ISE-009, 7 days) and authorized consumers (<unit>.<subscription>, the kit's group). Types, versions, aggregate, scope and sequencing come from each domain'scontract.yaml, copied into the jar by the build. At start the backbone applies the register, audits changes asise.config.changed, and makes each topic, its ingress, its rejection return and each authorized consumer's dead-letter topic. A platform unit's workload name isise-<folder>, this one'sise-event-backbone. - The broker abstraction is the module's
Brokerinterface: partitioned logs, offsets, timestamps, retention, consumer-group offsets. It has two implementations,KafkaBroker(production) andPostgresLogBroker(a log in PostgreSQL, with one active consumer per group).BrokerEventTransportputs the kit'sEventTransporton either.BrokerMigrationmoves retained records partition by partition, keeping key, value, headers and timestamp, and moves every group's committed offset to the first record it had not consumed. That is the broker replacement of TEST-ISE-019. - The domain event archive. An observer group reads every domain topic and writes each record to
event_archive(2 years, CFG-ISE-009). It measures end-to-end propagation latency for the critical ADT, order and result topics as a consumer sees it, as the timerhis.backbone.propagation. The reconciliation counts join the archive with each group's committed offsets and the dead letters. A replay from a retained position reads the archive, not the broker. - Replay sends the original records again to the subscription's topic: same event identifier, key, payload and headers, original order per aggregate, marked
his-replay-idandhis-replay-target. The target subscription applies what it had not applied; every other subscription's inbox acknowledges a duplicate with no effect (BR-ISE-005). Items not valid against the current contract are Held, with every later item of their aggregate. A target whose consuming unit is on the replay-sensitive list (CFG-ISE-007:cli-medication,fin-revenue-cycle,adm-identity) waits for the owning domain's confirmation and a second analyst's authorization, given by two different people, neither of them the requester as second authorizer (CUX-64). - Dead letters stay the kit's: its inbox writes
<topic>.dlt.<unit>.<subscription>after its bounded attempts, now withhis-dlt-attemptsandhis-dlt-first-failed-at. The backbone collects them into DE-ISE-010 and publishes InterfaceMessageDeadLettered. - This unit's copy of the kit gains
his.events.outbox.topic-suffix(.ingresshere: the backbone's own events pass its gate), the causation of a root event set to its correlation identifier, and the two dead-letter headers. It also takes the audit unit's fixes (ADR-HIS-050): the contract's audit payload and the pinned compression libraries.
Rationale¶
Only a gate that alone writes the topics lets the backbone itself reject: a check in each producer is the producer trusting itself, and a check after the fact lets a consumer act on the event first. One more hop costs milliseconds against a 5-second target. A second implementation that really runs is the only proof that the abstraction holds. Without it, an interface proves nothing, and the replacement exercise has nothing to move between. PostgreSQL is already in every environment.
Kafka offsets cannot be grouped by event type and facility, and offset-for-time ends with the 7-day retention. The archive the specification already requires does both, and does not depend on the broker. Resetting a group's offsets needs the group stopped and replays everything after the point. A redelivery topic would need every consumer changed. Sending the original records again is exactly what BR-ISE-005 makes safe, and the kit's inbox already enforces it.
Consequences¶
- Until the service template adopts the gate, units publish to their topics directly. That is
topic-suffix.ingressand the causation of a root event inservices/_template, then in each unit. Their events are archived and counted (his.backbone.observer.ungated) but not validated. The template session takes this up (handover follow-up); broker ACLs follow workload authentication. - A unit that consumes a topic must be listed as an authorized consumer in the register. Otherwise it has no dead-letter topic in production, and its subscription stalls on a poison event. The monitor reports it as
unregistered-consumer. - The policy actions
ise.event-topic.read,ise.dead-letter.read,ise.dead-letter.close,ise.replay.request,ise.replay.confirm,ise.replay.authorize,ise.replay.readandise.subscription-counts.readare for D10 to register. So are the audit typesise.message.replayed,ise.dead-letter.closedandise.service-identity.denied, which D02-ISE 9.5 lists but the audit catalogue does not seed yet. - The archive grows with every event of the enterprise. It is pruned at 2 years. Partitioning it by day is for the integrate session to measure.