Skip to content

Fix fhir-auth-tx: catch FHIR connection failures, refresh docs - #195

Open
Croway wants to merge 1 commit into
mainfrom
worktree-fhir-auth-tx-fix
Open

Fix fhir-auth-tx: catch FHIR connection failures, refresh docs#195
Croway wants to merge 1 commit into
mainfrom
worktree-fhir-auth-tx-fix

Conversation

@Croway

@Croway Croway commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The fhir-auth-tx route only caught ProtocolException, but connection failures to the FHIR server actually surface as FhirClientConnectionException/RuntimeCamelException. Since those went uncaught, the file consumer never marked the input file as handled, causing it to be reprocessed on every poll indefinitely.
  • Broadened the onException clause to cover the actual exceptions thrown, added a bounded redelivery policy with backoff, added a catch-all handler as a backstop, and set moveFailed on the file consumer as defense in depth.
  • The README described a stale hl7v2.patient/HL7v2 flow instead of the actual patients.csv + transaction Bundle flow, and pointed at a personal GitHub fork (rkorytkowski/hapi-fhir) for an auth-enabled HAPI server. Replaced it with a Docker Compose setup (HAPI FHIR JPA server behind an nginx reverse proxy enforcing HTTP Basic auth) under fhir-auth-tx/containers, and updated serverUrl accordingly.

Test plan

  • mvn verify passes for the module (existing mocked MyCamelApplicationTest still green)
  • Started the new docker-compose.yml (HAPI FHIR + nginx basic-auth proxy) and confirmed 401 without/with wrong credentials, 200 with correct ones
  • Ran the packaged app against the Docker FHIR server: dropped patients.csv, confirmed the transaction Bundle was created successfully
  • Stopped the FHIR server and dropped another file: confirmed the route retried with backoff, logged the error once, and moved the file to .camel/ instead of looping forever

🤖 Generated with Claude Code

https://claude.ai/code/session_016WKaCqZQd9uUiQR6QMZJkJ

The route only caught ProtocolException, but connection failures to the
FHIR server actually surface as FhirClientConnectionException or
RuntimeCamelException. Since those went uncaught, the file consumer never
marked the input file as handled, causing it to be reprocessed on every
poll forever. Broaden the onException clause to cover both, add a bounded
redelivery policy with backoff, add a catch-all handler as a backstop, and
set moveFailed on the file consumer as defense in depth.

Also update the stale README, which still described the old
hl7v2.patient/HL7v2 flow instead of the actual patients.csv + transaction
Bundle flow, and pointed at a personal GitHub fork for the auth-enabled
HAPI server. Replace it with a Docker Compose setup (HAPI FHIR server
behind an nginx reverse proxy enforcing HTTP Basic auth) under
fhir-auth-tx/containers, and point serverUrl at it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WKaCqZQd9uUiQR6QMZJkJ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant