No announcement yet.

How does Source Connector Response gets the response from a destination?

  • Filter
  • Time
  • Show
Clear All
new posts

  • How does Source Connector Response gets the response from a destination?

    For a TCP Listener in MLLP mode, the Response field can be set to any of the available destinations, independently of the destination connector type.

    How does the source connector get the response from a destination if the destination Connector type is whatever like JS or database writer?

    Not sure how this works, can't find this on the docs.

    I tried to return a string from a JS Writer destination and tried returning an ACK generated with Response Factory, on both cases I'm getting "Error evaluating response transformer" with the exception "syntax error unexpected token: X". Where X is the first character of the string I returned from the JS Writer.

    Is there an example of a destination that generates an ACK for a source that selects that destination as response?


  • #2
    If you are using a JS writer you have to create your ack there in the script and then return the ACK. Like here I am creating a custom, non HL7 informative response

    var channelResponse = new Response(Status, Text);
    return channelResponse
    //Status - SENT, ERROR, QUEUED or FILTERED only.
    If you want to generate an HL7 ACK the syntax changes to

    channelResponse= new generateAckResponse(connectorMessage.getRawData(),'AA','Successful');
    return channelResponse;
    Last edited by siddharth; 10-30-2017, 12:35 AM. Reason: foo
    HL7v2.7 Certified Control Specialist!


    • #3
      Perfect, so the key is to return a Response object instead of string or xml.

      Just wondering what happens on File Writer or DB Writer when the Source Response option is set to one of those destinations since those can't create a response object.

      I tried also with a TCP Sender Destination, selecting the Response on the Source Connector to be that destination, and without doing anything the system that sent the message to Mirth gets the response correctly. It is really obscure how the Response option works on different cases. I suppose I need to test every option and create my own documentation