Skip to content

message.setAckMessage

Signature: message.setAckMessage(value)

Returns: void

Sets value as the message's ACK message.

Note

This method only applies to the following formatted messages: HL7, ASTM, Binary, CSV, DICOM, EDIFACT, Old Fxd Width, Fxd Length, ISO 8583, JSON, Text, X12, XML.

Parameters

Type Name Description Default
String or byte[] value the ACK message

Example

// Example: Set a custom ACK message for the current message.

// assumes `message` is an HL7 message model object, like:
//    MSH|^~\&|SendingApp|SendingFacility|ReceivingApp|ReceivingFacility|202311071230||ADT^A01|123456|P|2.3
//    PID|1||123456^^^&1.2.3.4&ISO||Doe^Jane||19850515|F|||123 Elm St^^Somecity^ST^12345||(555)123-4567^PRN^PH^^^555^1234567


// Example: value as String (HL7 ACK message)
var ackMessage =
"MSH|^~\\&|ReceivingApp|ReceivingFacility|SendingApp|SendingFacility|202311071235||ACK^A01|123456|P|2.3\r" +
   "MSA|AA|123456";

message.setAckMessage(
   ackMessage // value (String)
);


// Example: value as byte[]
var ackBytes = new java.lang.String(ackMessage).getBytes("UTF-8");

message.setAckMessage(
   ackBytes // value (byte[])
);


// Retrieve the ACK to confirm it was set
var updatedAck = message.getAckMessage(); // byte[]