Loading

Mule 4 How to generate ACK when there is HL7 data parsing error with incoming payload

Publiceringsdatum: Aug 6, 2025
Uppgift

GOAL

This article provides guidelines on how to generate the Reject Acknowledgement when inbound HL7 data parsing fails with fatal exception. It also provide the guidelines on how to extract Version ID, Processing ID and Message Control ID fields from the incoming payload and dynamically populate 

Steg
1) For illustration purpose consider the below mule flow that receives HL7 data over MLLP listener. 
User-added image
2) Configure On Error Continue handler for catching errors thrown during HL7 Read process.
3) In case of fatal exception, mule application needs to populate reject ACK with Version ID, Processing ID and Message Control ID fields based on the Input HL7 payload.
   
     Reference transformation logic to populate the ACK message:
%dw 2.0
output application/json
var aux = (payload splitBy("\r"))[0] splitBy("|")
var pt = aux[sizeOf(aux)-1]
var version = aux[sizeOf(aux)-2]
var controlNumber = aux[sizeOf(aux)-3]
var msaError = "AR"
var errorCode = "207"
var errorDesc = error.description
---
{
"Name":"ACK", 
"MSH":null, 
"Id":"ACK", 
"Data":{
    "ACK":{
        "MSH":{
            "MSH-10":"76173", 
            "MSH-08":"29379", 
            "MSH-11":{"PT-01":version}, 
            "MSH-12":{"VID-01":pt}, 
            "MSH-03":{"HD-01":""}, 
            "MSH-04":{"HD-01":""},
            "MSH-05":{"HD-01":""}, 
            "MSH-06":{"HD-01":""}, 
            "MSH-07":{"TS-01":""}, 
            "MSH-09":{
                "MSG-03":"ACK", 
                "MSG-02":"A01", 
                "MSG-01":"ACK"}
            }, 
            "ERR":[{
                "ERR-01":[
                    {
                    "ELD-04":{
                        "CE-01":errorCode, 
                        "CE-02":errorDesc, 
                        "CE-03":"HL80358"
                        }, 
                    "ELD-01":"PV1", 
                    "ELD-02":1, 
                    "ELD-03":3
                    }
                ]
            }], 
            "MSA":{"MSA-02":controlNumber, "MSA-01":msaError}
        }
    }
}

 
Knowledge-artikelnummer

001115823

 
Laddar
Salesforce Help | Article