Architecture / Decision records / ADR-HIS-115
ADR-HIS-115 Controlled replay and reconciliation in the integration engine: replay re-queues the original transaction with its key, reconciliation counts what the engine made and what owning domains supply, and classifications are routed by whether they need a business decision¶
| Status | Accepted |
| Decided | 2026-12-01 by session RC-3-S16 |
| Record | Drafted 2026-12-01; approved 2026-12-02 by the Enterprise Architecture Board |
| Where the rule lives | platform/integration-engine/ (mod-ise-003: Replays, Reconciler, Reconciliations, DeliveryStatuses, Engine.replay, Workers.checkQueues, StepUp; V3__replay_reconciliation.sql) |
Context¶
RC-3-S16 builds part 2 of the integration engine, MOD-ISE-003: FR-ISE-INT-005 (reliable delivery, idempotency and controlled replay) and FR-ISE-INT-006 (message-to-transaction reconciliation). Part 1 (ADR-HIS-111) built the engine: durable storage before acknowledgement, retries per the registration's policy, order per ordering key, quarantine and dead letters. The contracts of RC-3-S03 (ADR-HIS-085) fix the 11 operations this part serves and the events ReconciliationExceptionRaised and EventReplayExecuted. The contract point of RC-3-S16 (contracts/ise README) also asks the unit to report the delivery of each Domain 1 event to contracts/adm adt.v1 submitEventDeliveryStatuses.
The specification leaves these open: what replaying a message does to its transaction; how a replay is rate-controlled; which business transactions count as expected; what each classification of part 2 means for an HL7 v2 interface; which classifications go to integration operations and which to the owning domain (part 4 names only the unmatched inbound one); and when an HL7 v2 message counts as processed.
Decision¶
- A replay re-queues the original transaction. It does not make a new one. The message keeps its MSH-10 (the idempotency key, part 2) and its receipt time, so the delivery queue sends replayed messages of one ordering key in their original order, as it sends every message. The transaction goes from Dead-lettered, Quarantined or Rejected to Retrying, with the replay named in its history, and the worker sends it (Sent). It has one attempt: if that fails, the same worklist item returns to dead-letter with the attempt recorded (WF-ISE-003), not a new item. An inbound item is validated and routed again, as on receipt. Its targets' messages carry its MSH-10.
- Current contract, not current data. An outbound item is checked against the target's agreed HL7 v2 version and the structure before it is queued. An item quarantined because it could not be mapped is mapped again with the current mapping. An item that fails is Held, with "Payload not valid for current version", noted on its worklist item and alerted for the Integration Engineer. Every later item of its ordering key in the replay is held too, so order is never broken (section 10).
- Rate control is a release schedule. A running replay gives each item a release time, its rank in the original order times 60 seconds divided by
his.integration.replay.messages-per-minute(60). The replay worker releases the due items; an item waits while an earlier item of its key has not been released. The rate is shown on the replay before it runs. - Replay-sensitive is a property of the target. An interface is replay-sensitive (CFG-ISE-007) when its registration's
replaySensitiveis true, or when it or one of its route targets is onhis.integration.replay.sensitive-targets. The default list iscli-medication,fin-revenue-cycleandadm-identity, as in platform/event-backbone. The two decisions are recorded as in event-operations.v1 (RC-1-S13): one per role, by two different people, and the requester is never the second authorizer. The second authorizer's approval is signed in place: the step-up token is verified as the Release Manager's approval is (ADR-HIS-111), and used once. A replay started on the console createsise.replay-approvalthrough workflow.v1createTaskin the queue<domain>.replay-approval. The task is created by the worker with a fixed key, so it is created once and retried while the task service is down. - AA is processing. The engine uses the HL7 v2 original acknowledgement mode, in which MSA-1 AA is the receiving application's acknowledgement. An AA therefore records
processedAtas well asacknowledgedAt. CA (enhanced mode, accept only) does not. "Acknowledged but not processed" can only arise once enhanced mode is supported (a follow-up of RC-3-S15). - What is expected. The expected transactions of an interface are the references its owning domain supplies (
submitTransactionReferences), and every outbound message the engine made from a source: a Domain 1 event (ADR-HIS-085: "the engine takes the events it routes as the expected transactions") or an inbound message it routed. A reference matches a message when the message's source event or MSH-10 is the reference, or when they share a business identifier other than the patient's, with the same message type if the reference names one. A service may supply references only for interfaces of its own domain (its client name's prefix); a person is decided by the policy decision point. On an inbound-only interface, references are the transactions inbound messages are matched against (for a results interface, the orders awaiting results). They raise no "transaction without message": a result's turnaround is not the staleness threshold. - Classifications and their route (part 2 and part 4):
| Classification | When | Routed to |
|---|---|---|
| transaction without message | A supplied reference of a sending interface that no message carries, older than the threshold | integration operations |
| message without acknowledgement | Sent and not acknowledged within the threshold, or dead-lettered after timeouts or errors | integration operations |
| stale | Held, not yet sent, beyond the threshold | integration operations |
| rejected | Dead-lettered after negative acknowledgements (AE, AR), or closed with referToOwningDomain |
owning domain |
| acknowledged but not processed | Acknowledged and not confirmed processed within the threshold | owning domain |
| unmatched inbound | A valid inbound message whose business identifiers match no reference | owning domain (PR-INT-006-2) |
The first three are technical: the engine, a partner link or a feed must be fixed, then the item replayed. The last three need a decision only the owning domain can take: whether to change and resend an order or admission, or what to do with an orphan result. They publish ReconciliationExceptionRaised. A quarantined or closed message is a difference listed in the run's evidence, with its message exception, which is already on the quarantine and dead-letter worklist. One exception is kept per interface, classification and subject (a transaction or a reference). A technical exception whose message has since been acknowledged is resolved by the next run, with the reason in its history.
8. When. A scheduled run's period ends the staleness threshold before now, and starts where the last scheduled run ended, so each item is judged once it is old enough. The schedule and threshold are the reconciliation procedure's, or by tier as CFG-ISE-008 gives them. A post-outage run of every interface in service follows each DowntimeEnded (over the window) and each FailoverCompleted (over its gap windows, or the hour before it). The transactions of a downtime window take its downtimeId. An inbound interface whose owning domain has never supplied a reference cannot be matched, so its run is Incomplete (section 10). Escalation (PR-INT-006-3) uses the escalation times of CFG-ISE-023 by the interface's tier: 15 minutes, 30 minutes, then a day.
9. Delivery statuses are an outbox of their own. Each status of a Domain 1 event on an interface is written once (unique event, interface and status), in the transaction of the change that makes it: delivered at the first send; acknowledged, and processed for AA; rejected when negative acknowledgements exhaust the attempts. The worker reports them in batches with the engine's service identity, and keeps a batch adt.v1 does not take. The consumer's owningDomain is ISE, as the contract's example has it. It is clinical when the interface is Tier 1 or critical, or routes to Domains 3 or 4 (CFG-ADM-012).
10. Queue alerts are measured by the engine. The engine computes depth and oldest age per interface every 30 seconds as gauges, and raises an alert counter once per level reached of the CFG-ISE-006 thresholds. The alert rules for routing belong to platform/observability.
Consequences¶
- Replay needs no new delivery path. Order, circuits, throttling and node authentication apply to replayed messages as to any other. A partner that keeps an inbox by MSH-10 applies a replayed message at most once (BR-ISE-005).
- A replayed message that is not acknowledged within its one attempt returns to dead-letter at once. An operator replays it again when the cause is fixed, rather than waiting on the retry policy a second time.
- The routes of point 7 are this decision's reading of part 4. If the owner of D02-ISE routes them differently, only
Reconciler.TECHNICALchanges. - The backbone half of the delivery statuses (subscription receipts and sequence gaps) cannot be read from event-operations.v1, which has daily counts and dead letters, not per-event receipts. The engine reports its interfaces only. Domain 1 still opens items from the backbone's InterfaceMessageDeadLettered. A later event-backbone session, or a minor version of event-operations.v1, takes the rest (handover RC-3-S16).
- Reconciliation reads the engine's own tables. A period of a month on a Tier 1 interface is a large run, so an operator's run is limited to 31 days.