Skip to content

Implementation plan / Session plan / Handover RC-3-S16

Handover RC-3-S16 Build: Platform: integration engine (part 2 of 2)

Card: RC-3-S16. Issue: cema-care/his#72. Branch: session/RC-3-S16. Slice: RC-3. Decision record: ADR-HIS-115.

What was built and where

Everything is in platform/integration-engine/, except the decision record and this handover. The unit's README.md describes every part, setting and metric. Part 1 is RC-3-S15.

Scope as read. The card covers two requirements of MOD-ISE-003 and their test scenarios: - FR-ISE-INT-005, reliable delivery, idempotency and controlled replay: TEST-ISE-015 and TEST-ISE-016; - FR-ISE-INT-006, message-to-transaction reconciliation: TEST-ISE-017.

It also covers the contract point of RC-3-S16 in contracts/ise/README.md, and the control of the safety-critical function "message delivery between ordering, fulfilment and results" (D02-ISE 11.1). No contract file changed.

What was built: - Migration V3__replay_reconciliation.sql: - replays, their decisions and items; - transaction references; - reconciliation runs and exceptions; - delivery statuses; - on message exceptions, replay_id and referral. - Controlled replay (Replays): requestMessageReplay, readMessageReplay and authorizeMessageReplay, and the replay worker. - A replay re-queues the original transaction with its MSH-10, in the original order per ordering key, at 60 messages a minute. - An item not valid against the current contract version is Held and referred to the Integration Engineer, and so is every later item of its ordering key. - A replay-sensitive target (CFG-ISE-007) waits for the owning domain's confirmation and a second analyst's signed authorization, by two different people. A replay started on the console creates ise.replay-approval through workflow.v1 createTask. - EventReplayExecuted is published when a replay completes. Everything is audited as ise.message.replayed. - The engine (Engine.replay) now validates and routes an inbound item again on replay. A replayed item that fails again returns to dead-letter on the same worklist item. - Reconciliation (Reconciler, Reconciliations): - submitTransactionReferences; - runs: startReconciliationRun, listReconciliationRuns, readReconciliationRun, with counts and evidence; - the worklist: listReconciliationExceptions, readReconciliationException, assignReconciliationException, resolveReconciliationException. - Runs are scheduled per CFG-ISE-008, follow every DowntimeEnded and FailoverCompleted (new subscriptions ise-downtime and ise-failover), and can be started by an operator. - The six classifications are routed as ADR-HIS-115 point 7 says; the business ones publish ReconciliationExceptionRaised. Exceptions are escalated per PR-INT-006-3. - closeMessageException with referToOwningDomain now raises a rejected exception to the owning domain. Part 1 refused it. - Delivery statuses (DeliveryStatuses): delivered, acknowledged, processed and rejected per Domain 1 event and interface, reported to contracts/adm adt.v1 submitEventDeliveryStatuses. - Queue depth and age (Workers.checkQueues): gauges per interface, and alerts at the CFG-ISE-006 thresholds of the tier (FR-ISE-INT-005 part 8, PR-INT-005-4). - Changes to part 1's code: - MSA-1 AA records processedAt (ADR-HIS-115 point 5); - the delivery worker maps any message that has no mapped payload yet, not only one in state Received, so a stop mid-delivery cannot leave one it cannot send; - transactions carry downtimeId; - StepUp verifies the signature of any decision signed in place, not only a production activation; - the new peer setting his.integration.peers.workflow (HIS_ESS_COORDINATION_URL).

Checks and their result

The checks ran on the host (JDK 21.0.13, Docker) with the light integration environment of this session (HIS_SESSION=RC-3-S16).

Check Command Result
Unit build and every test ./gradlew build in platform/integration-engine passed. Module: 85 tests (68 of part 1, 17 new), 4 of them the contract tests. App and kit: every test
New tests ./gradlew :mod-ise-003:test --tests '*ReplayTest' --tests '*ReconciliationTest' --tests '*DeliveryStatusTest' 17 passed
Provider contract test contract/IntegrationContractTest.providerContract his-contract verify contracts/ise of all 32 operations of integration.v1 from the example states (78 cases): passed. validate-event of the 8 events published, including ReconciliationExceptionRaised and EventReplayExecuted: passed
Consumer contract tests IntegrationContractTest.admConsumer, essConsumer (and part 1's iseConsumer) adt.v1 submitEventDeliveryStatuses against his-contract serve contracts/adm, workflow.v1 createTask against serve contracts/ess, with part 1's calls: no violation
Secret scan secret-scan code origin/main, secret-scan docs origin/main no secret
Documentation check_links.py; mkdocs build 0 broken, 0 duplicate anchors; builds

Static analysis and the dependency and image scans are left to the pipeline (CLAUDE.md section 3). No dependency was added.

Requirements and test scenarios

Every test names its requirement and, where one exists, its scenario: a JUnit @Tag and a display name. The tests are in platform/integration-engine/mod-ise-003/src/test/java/care/cema/his/ise/mod003/.

Requirement, criterion or scenario Covered by
FR-ISE-INT-005 AC-01: duplicate and delayed delivery create no duplicate clinical action (PR-INT-005-1, BR-ISE-005) ReplayTest.duplicateAndDelayedDeliveryNoDuplicateEffect: a redelivered event makes one message; a lost acknowledgement is retried with the same MSH-10; the partner's inbox applies it once. Inbound duplicates: EngineTest.validInboundRoutedOnceAndDuplicateAcknowledged (part 1)
AC-02: target outage; retried with backoff, dead-lettered after the configured attempts, none lost ReplayTest.outageDeadLettersNoneLostThenBulkReplay; part 1's EngineTest.outageQueuesThenDelivers, exhaustedDeadLetters
AC-03: an engine restart during traffic loses no acknowledged message (parts 1, 9) ReplayTest.restartDuringTrafficLosesNothing
AC-04, PR-INT-005-3, part 7, BR-ISE-006: medication replay refused without second authorization ReplayTest.medicationReplayNeedsSecondAuthorization, owningDomainRequestAndRejection
Part 6: replay by an authorized operator; scope and target shown first; original key and order; rate control ReplayTest.deadLetteredReplayedWithOriginalKey, outageDeadLettersNoneLostThenBulkReplay, selectionRules
Section 10: an item invalid against the current contract is held and referred to the Integration Engineer ReplayTest.heldWhenNotValidForCurrentVersion
WF-ISE-003: a replay that fails again returns to dead-letter with the new attempt ReplayTest.replayFailsAgain
Inputs: replayable states, one interface, confirmed bulk count; Idempotency-Key; replay permission separate from read (section 13) ReplayTest.selectionRules
Part 8, PR-INT-005-4: queue depth and age measured and alerted per interface DeliveryStatusTest.queueAgeAlerts
Section 12: replay audited with operator, second authorizer, reason, scope, outcome ReplayTest.deadLetteredReplayedWithOriginalKey, medicationReplayNeedsSecondAuthorization
TEST-ISE-015 (duplicate and delayed deliveries, target outage, engine restart) ReplayTest tagged TEST-ISE-015 (6 tests) and DeliveryStatusTest.queueAgeAlerts
TEST-ISE-016 (replay into a medication workflow with and without second authorization) ReplayTest.medicationReplayNeedsSecondAuthorization, owningDomainRequestAndRejection
FR-ISE-INT-006 AC-01: a sent but never acknowledged message appears on the worklist ReconciliationTest.sentUnacknowledgedAndOrphanResult
AC-02, PR-INT-006-2: an orphan inbound result is detected and raised to the owning domain ReconciliationTest.sentUnacknowledgedAndOrphanResult
AC-04, PR-INT-006-1: after an outage window the counts equal the expected transactions or every difference is listed ReconciliationTest.outageWindowCountsReconcile
AC-03: acknowledgement, error handling, replay, reconciliation and monitoring demonstrated per critical interface The tests above together, on the Tier 1 interface adm-adt-lis-01. The acceptance evidence for each critical interface of the inventory is the gate's (RC-3-E2E-003)
Parts 1 to 5, section 11: matching, classification, worklist, routing, counts kept as evidence; Open, Assigned, Resolved, Closed with history ReconciliationTest.sentUnacknowledgedAndOrphanResult, outageWindowCountsReconcile, worklistLifecycleAndEscalation
Section 10: reference feed unavailable means the run is incomplete; closure without reason refused ReconciliationTest.referenceFeed, worklistLifecycleAndEscalation
PR-INT-006-3: escalation per interface criticality ReconciliationTest.worklistLifecycleAndEscalation
Trigger: scheduled, after outage or failover, on request (CFG-ISE-008) ReconciliationTest.scheduledRuns, outageWindowCountsReconcile (DowntimeEnded), sentUnacknowledgedAndOrphanResult (operator)
Preconditions: references from the owning domain only, accepted once ReconciliationTest.referenceFeed
Section 12: resolutions and closures audited ReconciliationTest.worklistLifecycleAndEscalation
WF-ISE-003 step 8: closure referred to the owning domain ReconciliationTest.closureReferredToOwningDomain
TEST-ISE-017 (sent-but-unacknowledged message and orphan inbound result; counts reconcile) ReconciliationTest (6 tests, tagged TEST-ISE-017)
Contract point: delivery statuses to adt.v1 submitEventDeliveryStatuses DeliveryStatusTest.statusesReported, IntegrationContractTest.admConsumer
Contract tests contract/IntegrationContractTest (4 tests)

Safety-critical function: "message delivery between ordering, fulfilment and results" (D02-ISE 11.1). The control is durable queues, acknowledgement tracking, dead-letter visibility, reconciliation worklists and queue age alerts. Its verification is the "outage, lost-acknowledgement and reconciliation tests", and they pass: - outage: ReplayTest.outageDeadLettersNoneLostThenBulkReplay, restartDuringTrafficLosesNothing; - lost acknowledgement: ReplayTest.duplicateAndDelayedDeliveryNoDuplicateEffect, ReconciliationTest.sentUnacknowledgedAndOrphanResult; - reconciliation: ReconciliationTest; - queue age: DeliveryStatusTest.queueAgeAlerts.

The hazard log (SAFE-001) is kept outside the repository (D02-ISE 11; architecture section 13). Its entry is asked for under "Needs a person".

Non-functional targets: - NFR-ISE-005 security: - the decision point on every operation, with replay, authorization and confirmation as permissions of their own, separate from read; - the second authorization signed in place and used once; - references only from the owning domain's services; - payloads stay encrypted, and replay works on them in place. - NFR-ISE-009 interoperability: the 32 operations verified; ReconciliationExceptionRaised and EventReplayExecuted validated; the consumer calls to adt.v1 and workflow.v1 checked against their stubs. - NFR-ISE-012 observability: the gauges and alerts of the README; every run, replay and exception carries its correlation identifier. - NFR-ISE-016 time integrity: UTC throughout; periods and thresholds are compared on the server's clock. - NFR-ISE-018 localization: no screen; Problem text is English, with a stable code.

Differences from the card, the specification or the contracts

No contract file changed.

  • The backbone's per-event receipts and sequence gaps are not reported to Domain 1. The contract point asks the engine to report them "read from the event-operations of RC-1-S13". event-operations.v1 has no per-event receipt or gap. It has daily counts per subscription (readSubscriptionCounts) and the dead letters, which Domain 1 already takes as InterfaceMessageDeadLettered. The engine reports the statuses of its own interfaces: ACK, NACK and MSH-10, as the contract point asks. The backbone half needs a minor version of event-operations.v1, or the backbone reporting itself (handover RC-3-S03 already says "a later backbone session may take this over"). It is a follow-up and a question below.
  • The routing of each classification is decided in ADR-HIS-115 point 7. Part 4 of FR-ISE-INT-006 names only the unmatched inbound one. The owner of D02-ISE is asked to confirm it.
  • MSA-1 AA counts as processed (ADR-HIS-115 point 5): in the original acknowledgement mode, which is the only one the engine speaks, AA is the application's acknowledgement.
  • Expected transactions are the supplied references and every outbound message the engine made from a source (ADR-HIS-115 point 6). References on an inbound-only interface are matched against, but raise no "transaction without message", since a result's turnaround is not the staleness threshold.
  • A replayed outbound message has one attempt. If it fails, the item returns to dead-letter at once (WF-ISE-003, "Replay fails again"), rather than waiting on the retry policy a second time.
  • A bulk replay of more than one item needs confirmedItemCount, not only a matching one when it is sent. The contract has it "for a bulk replay"; a selection without it is refused.
  • The approval task's queue is <owning domain>.replay-approval (setting his.integration.replay.approval-queue). The contract names the task type and "the owning domain's queue", but not the queue.
  • Escalation uses the escalation times of CFG-ISE-023 by tier (15 minutes, 30 minutes, a day), which is what "escalated per interface criticality" refers to.

Needs a person

None of these blocks the merge.

  • Enterprise Architecture Board: approval of ADR-HIS-115.
  • Clinical safety officer: the hazard log entry (SAFE-001) for "message delivery between ordering, fulfilment and results". Its control (FR-ISE-INT-005, FR-ISE-INT-006) is now built, and its verification passes (above).
  • Owner of D02-ISE (question): please confirm the routing of the reconciliation classifications in ADR-HIS-115 point 7. Transaction without message, message without acknowledgement and stale go to integration operations. Rejected, acknowledged but not processed, and unmatched inbound go to the owning domain.
  • Leads of D02-ISE and D01-ADM (question, contracts): the contract point of RC-3-S16 asks for the backbone's per-event consumer receipts and sequence gaps "from the event-operations of RC-1-S13". event-operations.v1 does not expose them. Should a minor version of event-operations.v1 add them, or should the event backbone report to adt.v1 submitEventDeliveryStatuses itself?

Follow-ups outside the card

  • Event backbone: the backbone's half of the delivery statuses (above).
  • Domain 10 policy content: the actions of this part:
  • ise.message-replay.request, .read, .authorize and .confirm (the last with owningDomain);
  • ise.transaction-reference.submit;
  • ise.reconciliation-run.start and .read;
  • ise.reconciliation-exception.read, .assign and .resolve (with owningDomain and routedTo, so that an owning domain reads and resolves its own).
  • Domain 10 workflow content: the queues <domain>.replay-approval for the task type ise.replay-approval.
  • Observability: alert rules on the new kinds of his_integration_alerts_total and on the queue gauges, routed per CFG-ISE-023.
  • Deployment: HIS_ESS_COORDINATION_URL for the approval task; the engine's service identity permitted on adt.v1 submitEventDeliveryStatuses (contracts/adm README, RC-1-S16 policy line).
  • Enhanced acknowledgement mode (from RC-3-S15): with it, "acknowledged but not processed" becomes reachable for HL7 v2.
  • RC-3-S20 (UI-ISE-001): the replay answer shows orderingKeys, rateLimit and replaySensitive before execution; confirmedItemCount is required for more than one item.
  • Design system: none from this session.