Announcement

Collapse
No announcement yet.

channelMap.put in response is not returning value when I call it in another dest.

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

  • channelMap.put in response is not returning value when I call it in another dest.

    **** version 3.8.1, on-Prem, active/active, Linux ****

    I swear that I had this working before, but now it's not. I have an HL7 TCP sender and I put on a response transformer with this code:

    Code:
    var myResponseMessage = response.getMessage();
    msg = myResponseMessage
    channelMap.put("responseText", msg)
    I see 'responseText' in my list of variables for the 2nd channel and I placed it in the 2nd channel body (SMTP sender) 2nd channel is set to wait for the previous destination.

    Code:
    Here is a NAK
    
    ${responseText}
    Here is the message
    ${message.encodedData}
    I have this working on another channel, but that is a JSON sender so the data types are different. But that one works. Channel is attached. Any ideas?
    Attached Files
    SIG|1|Brad|Mirth Certified Interface Analyst^Cancer Treatment Centers of America

  • #2
    So I understand this "I have set channel map variable(s) in a response transformer for one destination and I don't see its value when I use that variable in the second destination when I process a message"

    And you are sure the response transformer is firing? It won't always fire unless its type inbound type is set to raw. I didn't actually look are your code, just stating a fact about mirth.
    Last edited by pacmano; 04-01-2020, 03:54 PM.
    Mirth 3.8.0 / PostgreSQL 11 / Ubuntu 18.04
    Diridium Technologies, Inc.
    https://diridium.com

    Comment


    • #3
      You don't need to add that to the channelMap. It's already stored in the responseMap. You should be able to drag-and-drop your first destination from Destination Mappings into the template of your second destination. You'll end up with ${d1.message} unless the Id of your first destination isn't 1.

      To answer why it may not be working the way you have it set up, do you have "wait for previous destination" checked on your second destination? You'll need that for the above solution to work, too.

      Comment


      • #4
        @agermano - I do have the wait for previous channel set. My 2nd destination returns nothing when I drag in the prior connection. it's ${d12.message} in my case, but that still returns nothing. I can get the original messages from the ${message.encodedData} mapping, but can't get the response. How do I access the response map short of the steps I showed?

        @pacmano - I think the response transformer is firing because I had a logger.info(something) set and I see it in the dashboard. This is working on another channel with a JSON response so I tried other non HL7 data types for the response and no luck yet.

        Thanks for the responses and the ideas. I'm still plugging along and will compare this to my working JSON/SMTP destinations in the other channel.


        (searching now for info on the response map)
        SIG|1|Brad|Mirth Certified Interface Analyst^Cancer Treatment Centers of America

        Comment


        • #5
          figured out why it's not working

          My JSON destination is set to never queue, My HL7 one is set to queue. Now I remember the rabbit hole I went down last time. This does not work with queueing turned on. Not a desirable solution for this interface, but now I know why one works and one doesn't
          SIG|1|Brad|Mirth Certified Interface Analyst^Cancer Treatment Centers of America

          Comment


          • #6
            Can you use SMTPConnection from the User API to send the email from your response transformer instead of a second destination?

            Comment


            • #7
              Originally posted by agermano View Post
              Can you use SMTPConnection from the User API to send the email from your response transformer instead of a second destination?
              Yep - it's not pretty but this works

              Code:
              var rsp = response.getMessage();
              var raw = connectorMessage.getRawData()
              
              var email = 'NAK...' + rsp + '*************************************************************** '+ 'MSG...' + raw;
              
              
              var smtpConn = SMTPConnectionFactory.createSMTPConnection();
              smtpConn.send('[email protected]', '', '[email protected]', '[SEND SECURE] NAK ALERT', email, '');

              I needed the "***" to form a line break, It needs some tweaking but fixed our immediate needs.

              I feel pretty good that I was already headed that way when I read your post. You guys are rubbing off on me!
              SIG|1|Brad|Mirth Certified Interface Analyst^Cancer Treatment Centers of America

              Comment

              Working...
              X