Mirth Connect 3.12.0 Released!

Mirth Connect 3.12.0 is now available as an appliance update and on our GitHub page. This release includes database performance improvements, improves visual HL7 representation, message pruning, keystore handling, PDF generation, community contributions, and fixes several security vulnerabilities. This release also contains many improvements to commercial extensions. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

X12 ack as 'Respond From' on TCP Listener

  • Filter
  • Time
  • Show
Clear All
new posts

  • X12 ack as 'Respond From' on TCP Listener

    Anyone have any 'how-to' information on this?

    I have to do respond with the ACK over the same TCP connection that my source is sending on (the TCP Listener) using the 'Respond From' functionality using an ACK variable I'm building in the source transformer.

    Either the 'Respond From' feature is working, or I'm doing something wrong in building the ack response. This is an X12 messaging interface, so I need to respond with an X12 ack (ISA~TA1~IEA~) with start of text and end of text characters.

    This seems like a common use-case scenario.

    If anyone can shed some light on this, I would be very appreciative.

    Thank you.

  • #2
    Re:X12 ack as 'Respond From' on TCP Listener

    You need to use the Post Processor (under Scripts tab on the channel)

    responseMap.put("MYRESPONSE", ResponseFactory.getSuccessResponse("X12 MESSAGE"));

    The way "respond from" works is that it looks at the responseMap and sends the response object that is in the map. In the code above, we are placing a new response object into the responseMap and the key is "MYRESPONSE". This is what you will select in the dropdown for the "Respond From" on the source.

    The response factory simply creates a "SUCCESS" response with the message payload being whatever string you pass in, in this case "X12 MESSAGE". Of course you would probably want to build up an X12 template and fill it with the values needed for your ACK and use that as your response, but this is how you get Mirth to send back data on the same TCP connection.

    BTW - you also have an object called "serverSocket" in the channelMap on TCP and LLP connectors. This allows you get the raw socket object and send data directly during the channel processing (in case you need more control over the ACK process).
    Chris Lang


    • #3
      Re:X12 ack as 'Respond From' on TCP Listener


      Thanks alot. So the Post Processor is the only place for scripting the response object so that ir works appropriately? I placed the script in Source Connector transformer, which allowed me access to the response object in the 'repond from', but didn't send the response. I used the same script you used above. I'll try putting this in the Post Processor and post my results.




      • #4
        Re:X12 ack as 'Respond From' on TCP Listener


        This is still not working, and now I don't even see my Response Map in the Dashboard (mappings tab). Here's what I put in the post-processor:

        // This script executes once after a message has been processed
        ack = String.fromCharCode(2)
        + 'ISA*00* *00* *ZZ*ENVOY * * *080819*1640*U*00401*169222813*0*T*:~'
        + 'TA1*169222813*080819*1640*A*011~'
        + 'IEA*1*169222813~'
        + String.fromCharCode(3);
        responseMap.put('X12RESPONSE', ResponseFactory.getSuccessResponse(ack));

        And then I chose X12RESPONSE for my 'respond from' in the source connector. When I had this same script in the source connector transformer script, I was able to choose it for the 'respond from', and it was listed in the mappings in the dashboard.

        Thanks in advance for any additional help you may be able to provide.