An important part of the HL7 standard is the ACKnowledgment protocol. Every time an application accepts a message and consumes the message data, it is expected to send an ACKnowledgment message back to the sending application. The sending application is expected to keep on sending a message until it has received an ACK message.
If you do not follow this rule, data may be lost in transmission.
An acknowledgment message consists of two segments:
- An MSH segment, which contains information about the sending and receiving applications and contains the Message Control ID of the message;
- An MSA segment, which indicates whether the message was accepted or rejected.
The diagram below shows a typical ACK message with the important fields labelled:
An acknowledgment message is not sent until the data in the HL7 message has been read and consumed.
The Message Control ID, which is specified in field 10 of the MSH segment, is a unique identifier that is associated with a particular HL7 message. When a message is processed and acknowledged, field 10 of the MSH segment of the acknowledgment message contains the same identifier as the message that it is acknowledging. This is how applications can keep track of what messages have been successfully acknowledged.
The MSA segment indicates whether the message that is being acknowledged was processed successfully. The first field of the MSA segment contains the acknowledge status, which is one of the following:
|AA||Positive acknowledgment: the message was successfully processed.|
|AE||Application error: there is a problem processing the message. The sending application must correct the problem before attempting to resend the message.|
|AR||Application reject: there is a problem with field 9, field 11 or field 12 of the MSH segment of the incoming message, or there is a problem with the receiving application that is not related to the message or its structure.|