2
votes

I am using Mirth with a LLP listener receiving HL7v2 message.

The customer expects an ACK message from us and so we checked the "Send ACK" radio button. The only problem is that in the default ACK it puts MIRTH in the MSH-3.1 field. I need to change this to another value to say where it came from.

Is this possible?

2

2 Answers

6
votes

Mirth has a feature for customizing acks. I don't think it's documented, but their support staff directed us to it.

In the postprocessor:

var ackString = ""; //build a javascript string for your custom ack
var ackResponse = ResponseFactory.getSuccessReponse (ackString);
responseMap.put("Custom ACK", ackResponse);

Mirth parses the postprocessor code, and discovers the reponseMap code. On the source tab, you can now select "Respond from" and "Custom ACK" will appear as an option there.

The full code for building my custom acks is about 20 lines.

2
votes

I think the only way you will get around that is to use the "Respond From" setting under "Send Ack" and set your first Destination under "Destinations" to be an "Ack Sender" and build and send an Ack from there.

You could also use this mechanism if you ever encounter a situation where you should only Ack if you could successfully deliver the message in which case you would place your "Ack Sender" after the actual destination you send the message on with. Your "Ack Sender" destination would then have to build an Ack or Nack based on successful delivery. You could check that by checking the return status of the previous destination with something like:

var returnState = responseMap.get('DestinationName').toString();

if (returnState.substr(0,8) == 'SUCCESS:')
    // Successful Delivery or Processing
else
    // Failed Delivery or processing

Let me know if you need any more help ...

Frans