Announcement

Collapse
No announcement yet.

ACKGenerator help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ACKGenerator help

    Hi

    I need to generate a custom ACK which I've done using a postprocessor.

    Version of Mirth is 3.5

    It works fine but I keep getting the message in the log on the dashboard

    "Please call ACKGenerator methods statically (e.g. ACKGenerator.generateAckResponse(message, ackCode, textMessage))."

    The code I'm using to return an AA sent is....

    return ACKGenerator().generateAckResponse(message.getConn ectorMessages().get(0).getRawData(),'AA','Message Processed Successfully');

    That seems to be ok - not sure why its throwing an error message on the dashboard though?
    Last edited by stevenk; 06-28-2017, 08:29 AM.

  • #2
    Remove .get(0) and try.
    HL7v2.7 Certified Control Specialist!

    Comment


    • #3
      Hi

      I tried that but I don't get back the right response then

      it's going through a try catch and returns the catch(err) response
      Last edited by stevenk; 06-29-2017, 12:23 AM.

      Comment


      • #4
        here's the postprocessor code

        try
        {
        var httpResponse = responseMap.get('Destination1');

        var responseBody = "";

        if ( httpResponse.getStatus() == "SENT" )
        {
        return ACKGenerator().generateAckResponse(message.getConn ectorMessages().get(0).getRawData(),'AA','Message Processed Successfully');
        }


        else if ( httpResponse.getStatus() == "ERROR" )
        {
        return ACKGenerator().generateAckResponse(message.getConn ectorMessages().get(0).getRawData(),'AE','An Error Occured Processing Message');
        }
        }

        catch(err)
        {
        return ACKGenerator().generateAckResponse(message.getConn ectorMessages().get(0).getRawData(),'AA','Message filtered out by Interface');
        }

        Comment


        • #5
          I removed

          ACKGenerator().generateAckResponse

          and replaced with

          ACKGenerator.generateAckResponse


          that worked a treat

          Comment


          • #6
            many thanks "stevenk". This is the solution I was looking for

            Comment


            • #7
              Originally posted by stevenk View Post
              here's the postprocessor code

              try
              {
              var httpResponse = responseMap.get('Destination1');

              var responseBody = "";

              if ( httpResponse.getStatus() == "SENT" )
              {
              return ACKGenerator().generateAckResponse(message.getConn ectorMessages().get(0).getRawData(),'AA','Message Processed Successfully');
              }


              else if ( httpResponse.getStatus() == "ERROR" )
              {
              return ACKGenerator().generateAckResponse(message.getConn ectorMessages().get(0).getRawData(),'AE','An Error Occured Processing Message');
              }
              }

              catch(err)
              {
              return ACKGenerator().generateAckResponse(message.getConn ectorMessages().get(0).getRawData(),'AA','Message filtered out by Interface');
              }
              This is very userful for me! Thanks!
              I want to ask you a question about it!

              I want the 'AE' case to return the exact error that appears in the destination.

              Code:
              ACKGenerator().generateAckResponse(message.getConnectorMessages().get(0).getRawData(),'AE',$(destination).getError());
              I saw that if a destination errors out in the filter/transformer script, subsequent destinations in the same chain will not be executed, and the getError() for transformer script is empty, even if there is the detail of the error in my dashboard. When the error is in response script getError show me the correct value.

              I also try:
              Code:
              ACKGenerator().generateAckResponse(message.getConnectorMessages().get(0).getRawData(),'AE',$(destination));
              But, in this case, err is always: 'ERROR: Error converting message or evaluating filter/transformer'. I want the Reference Error, with more detail.
              How can I do?
              Thanks a lot

              Comment

              Working...
              X