Here is the pre-process script to remove LL errors:
var preMessageString = new java.lang.String(bytesIn, 'UTF-8');
qie.debug('preMessageString: ' + preMessageString);
var llError = StringUtils.substringBetween(preMessageString, '/-/', '\\-\\');
qie.debug('llError: '+ llError);
preMessageString = StringUtils.replace(preMessageString, '/-/' + llError + '\\-\\\r', '');
qie.debug('afterProcessing: ' + preMessageString);
try {
qie.parseHL7String(preMessageString);
bytesOut = preMessageString.getBytes();
} catch (err) {
qie.debug('error with parsing hl7 string: ' + err);
}
if (bytesOut === null) { //When null, the message is discarded and no further processing is done
//todo: when bytesOut = null, set responseBytes to acknowledge the receipt of discarded messages as needed
responseBytes = new java.lang.String('Replace with valid acknowledgement').getBytes();
}