The Path
Module 4 · Transport and acknowledgements·11 min
Acknowledgements
AA, AE, AR: what the receiver answers, and what to do when it fails.
Sending a message is good. Knowing it arrived and was understood is better. In HL7 v2, the receiver answers every message with a small return message: the acknowledgement, or ACK.
Here is the one the sleep lab sends back when it receives Marie Dubois’s admission.
The reply sent back after receiving the admission. The MSA segment carries the verdict: AA, accepted.
Just two lines. MSH says who is answering and to whom. MSA carries the verdict. Here, AA: all good. The text after MSA-2 is MSA-3, a deprecated field (see below): you will still see it a lot, as here.
How the sender knows what is being answered
The hospital record sends dozens of messages a minute. It needs to know which message this ACK is about. The rule is simple: the receiver copies the control ID of the incoming message (MSH-10) into MSA-2.
An admission. The hospital system announces a patient arriving for an overnight recording at the sleep lab.
The admission carries MSG00002 in MSH-10. Scroll back up to the ACK: MSA-2 is MSG00002 too. The loop is closed.
Building the ACK’s MSH
If you code a receiver, this is the first thing you write. The ACK’s MSH is built from the incoming message’s MSH:
| ACK field | Rule |
|---|---|
MSH-3 and MSH-4 |
take MSH-5 and MSH-6 of the received message (swap) |
MSH-5 and MSH-6 |
take MSH-3 and MSH-4 of the received message |
MSH-9 |
ACK, then the received event: ACK^A01^ACK |
MSH-10 |
a new ID, belonging to the ACK |
MSH-11 and MSH-12 |
usually copied from the received message |
MSA-2 |
the MSH-10 of the received message |
Two more rules. You never acknowledge an ACK: otherwise the two systems acknowledge each other forever. And some messages get a dedicated response instead of a generic ACK: in v2.5.1, an ORM^O01 order gets an ORR^O02, a QBP query gets an RSP.
| Field | Name | Content |
|---|---|---|
MSA-1 |
Acknowledgment Code | the verdict (HL7 table 0008) |
MSA-2 |
Message Control ID | the MSH-10 of the received message |
MSA-3 |
Text Message | free text, deprecated since v2.4 in favour of ERR |
Sleep lab
sender
Patient record
receiver
- ORU · MSH-10 = MSG00201
- ACK · MSA|AA|MSG00201
- ORU · MSG00202
- ACK · MSA|AE|MSG00202 + ERR
- Fixed ORU · MSG00203
- ACK · MSA|AA|MSG00203
Original mode: AA, AE, AR
This is the default mode. One reply, three possible verdicts:
| Code | Meaning | What the sender does |
|---|---|---|
AA |
accepted | nothing, all good |
AE |
error in the content | read ERR, fix, resend |
AR |
rejected, unrelated to the content | retry later, or raise an alert |
The difference between AE and AR matters. AE says “your message has a problem”. Resending it unchanged is pointless. AR says “I cannot process it”, for instance because the system is down, or because the message type or version is not supported. If it is an outage, the same message will go through later. If it is a refused message type, version or MSH-11, it will never go through without a configuration change.
The ERR segment: where and what
An AE with no explanation does not get you far. The details go into an ERR segment, which can repeat when there are several errors. The segment is older than v2.5, but back then it had a single field, ERR-1. Since v2.5, it is structured: where (ERR-2), what (ERR-3), severity (ERR-4). In older messages, you will only see ERR-1. Here is the lab’s reply to an admission with a badly written date of birth (PID|1||1024^^^LELEUX^MR||DUBOIS^Marie||12/03/1985|F).
The sleep lab refuses admission MSG00021: the date of birth is not in HL7 format.
Click each field of the ERR line:
ERR-2pinpoints the error: segmentPID, first occurrence, field 7. That is the date of birth.ERR-3gives the HL7 error code (table 0357).102: data type error.ERR-4gives the severity (table 0516):Eerror,Wwarning,Iinformation,Ffatal error.ERR-7adds a technical explanation in free text.
A few codes from table 0357 you will see often:
| Code | Meaning |
|---|---|
100 |
segments in the wrong order |
101 |
required field missing |
102 |
data type error |
103 |
value not found in table |
200 |
unsupported message type |
203 |
unsupported version |
207 |
application internal error |
Enhanced mode: two acknowledgements instead of one
Some systems split two questions: “did you receive and store my message?” and “did you process it?”. That is enhanced mode. The sender asks for it with two MSH fields:
MSH-15: when to send the accept acknowledgement (receipt);MSH-16: when to send the application acknowledgement (processing).
Each takes a value from table 0155: AL always, NE never, ER on error only, SU on success only. The accept acknowledgement has its own codes: CA (accepted for processing), CE (error), CR (reject). The application acknowledgement, sent later, uses AA, AE or AR again.
If MSH-15 and MSH-16 are empty, original mode applies.
In practice, the enhanced-mode application acknowledgement is a separate message, sent later by the receiver acting as a sender, often over another connection. And the case you will meet most is an interface engine returning a CA as soon as it has stored the message, before any real processing. That is exactly the trap described at the end of this lesson.
No ACK: now what?
Sometimes no acknowledgement comes back: network cut, receiver crashed. The sender waits for a timeout, then resends. As a result, the receiver may get the same message twice. A careful receiver remembers the MSH-10 values it has already processed and ignores a duplicate, rather than creating two admissions. For exchanges that need it, HL7 v2 also defines a sequence number protocol, in MSH-13.
Does a failed ACK block the queue?
This is the design decision of an interface, and the first question a project manager will ask you. A message gets AE, or no ACK at all. What does the sender do with the messages waiting behind it? Two options:
Blocking queue: [A01 in AE] [A08] [A08] [A03] nothing goes out, order is kept
Skipping queue: [A08] [A08] [A03] go out the A01 waits aside, order is broken
- Block: nothing goes past the failed message until someone fixes it or sets it aside. Order is guaranteed, but a single message can stop the whole feed.
- Skip: the failed message goes to a separate queue, the next ones carry on. The feed keeps flowing, but an update may arrive before the admission it changes.
For ADT, you almost always block: an update or a discharge without an admission makes no sense. For results that do not depend on each other, skipping can be defended. Either way, the choice goes into the specification, with an alert on the age of the oldest waiting message. And when you replay, you replay in the original order.
And in FHIR?
FHIR runs over the web: the answer is first an HTTP status code (200, 400, 422, and so on). Error details travel in an OperationOutcome resource, the modern equivalent of ERR.
Check your understanding
1 of 5The hospital record sends an admission with MSH-10 = MSG00021. What must MSA-2 contain in the acknowledgement?
+50 XPPass the quiz (4 correct answers) to complete the lesson.
Reviewed and checked on 27 September 2026