RTFM · Medical healthchecks
lb.saphira.hl7.mllp: ask the hospital bus a question (HL7 over MLLP)
HL7 v2 moves every admission, discharge and order in a hospital, framed over TCP by MLLP. The check sends a real query for a patient who cannot exist and requires a real, valid acknowledgement back; the message bus, proven, without touching a single record.
What it proves
A complete MLLP transaction: the check frames an HL7 v2 QRY^A19 patient query (MLLP framing: 0x0B … 0x1C 0x0D) and requires a properly framed ACK whose MSA-1 field is AA or CA; a genuine application-level acceptance, not merely a socket that echoed bytes. The queried patient (SAPHIRA-SYNTHETIC-PATIENT) does not exist, so no patient data is created or modified; the ACK itself is the proof.
This is the named capability "the HIS/integration engine answers HL7 queries"; deeper than any HTTP check can honestly claim about an MLLP-only system.
How it works
A small packaged python3 program does the transaction (the engine pattern in miniature): connect, send the framed query, accumulate until the end-block arrives, verify the framing, extract MSA-1, and vote. The whole payload can be overridden with LB_SAPHIRA_HL7_MESSAGE for sites whose integration engine demands a specific query shape; env only, never echoed, so operators who embed site-specific credentials in the override can do so safely.
Configuration
| Variable | Default | Meaning |
|---|---|---|
| LB_SAPHIRA_HL7_MESSAGE | built-in QRY^A19 | Full payload override (env only, never echoed) |
| LB_SAPHIRA_TIMEOUT | 3 | Transaction deadline |
| (target port) | $4, else 2575 | The MLLP listener: 2575 is the conventional port |
Wiring it up
# ldirectord.cf - integration engine pool
virtual = 203.0.113.10:2575
protocol = tcp
scheduler = lc
real = 192.168.20.31:2575 gate 1
real = 192.168.20.32:2575 gate 1
checktype = external
checkcommand = "/var/lib/lb/saphira/lb.saphira.hl7.mllp"
# haproxy.cfg - MLLP is plain TCP, pass-through mode
global
external-check
backend his_mllp
mode tcp
option external-check
external-check command "/var/lib/lb/saphira/lb.saphira.hl7.mllp"
server his1 192.168.20.31:2575 check inter 5s fall 3 rise 2
Run it by hand
/var/lib/lb/saphira/lb.saphira.hl7.mllp his-pool 2575 192.168.20.31 2575
echo $?
# 0 = framed ACK with MSA-1 AA/CA
# 1 = no answer, broken framing, or a negative ACK
Failure modes
- Connected but unframed garbage; the endpoint is not speaking MLLP (a raw TCP echo, a different framing): a mis-wired integration
- ACK with MSA-1 AE-missing: some engines answer a nonexistent patient with an application error code; if your site does, override the payload to a query your engine ACKs positively
Did we miss something?
If this page left something unanswered, found an error, or there is another subject you would like documented, tell us. Saphira’s documentation grows from real problems people need to solve.
Send feedback or request a new section →
Prefer not to do it yourself?
Everything needed to do the work yourself is documented here and remains free; we charge for human time, not for withholding knowledge. Sometimes the missing resource is simply time. The same people who build Saphira can provide paid professional help with implementation, migration, troubleshooting and administration.