Announcement

Collapse
No announcement yet.

Issue posting response message from HTTP sender to another destination

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

  • Issue posting response message from HTTP sender to another destination

    Hi Team,

    I am facing an issue while trying to post the response received from one destination to another destination after transformation. Below is the code I have written

    var Response = $('responseStatusLine');

    if(Response=='200'||Response == '201')
    {

    var Clinician_Response = responseMap.get('Request for GetAllFacilities').getMessage();
    channelMap.put('Clinician_Response',JSON.stringify (Clinician_Response));

    }
    else
    {
    throw('Invalid Status Code');
    }

    above code is in response filter in destination 1.

    in destination 2 I am trying to fetch the response through below code

    var Facilities_Body = channelMap.get($('Facilities_Response'));

    but the response is not being forwarded to another destination. Is there anything incorrect that I am doing ?

    Regards,
    Naveen

  • #2
    Firstly, you should search the forums, because the response to any destination is already available in any other destination so you don't really need to store it like you are.

    However in the code you post you never set Facilities_Response
    Diridium Technologies, Inc.
    https://diridium.com

    Comment


    • #3
      Sorry Pacmano,

      My bad, I was trying to use same logic in 2 transformations. Below is the code and and transformer code


      var Response = $('responseStatusLine');

      if(Response=='200'||Response == '201')
      {

      var Facilities_Response = responseMap.get('Request for GetAllFacilities').getMessage();



      channelMap.put('Facilities_Response',JSON.stringif y(Facilities_Response));

      }
      else
      {
      logger.info('Some Error Occured');
      //throw('Invalid Status Code');
      }

      Transformer code is

      var Facilities_Body = channelMap.get($('Facilities_Response'));

      I have tried to search in forum for above solution but was not able to find any relevant one. Sorry if I missed but this is what I am trying to do.

      I have setup 4 destinations in a channel and I am trying to send responses of top 2 destinations in bottom 2 destinations. In destination 1 response filter I have wrote the response code and in destination 3 transformation filter, I have wrote the get channel map and corresponsing code. My only issue is I am not able to route the response of destination 1 to destination 3. Is it that I am trying to do this in same channel that is the reason it is not working or do I need separate channels for this ?

      Regards,
      Naveen

      Comment


      • #4
        You should be able to access that channelMap variable in the destination you want to use it in

        Comment


        • #5
          My only issue is I am not able to route the response of destination 1 to destination 3
          Destination 3 transformer:
          Code:
          var Facilities_Body = $('Destination 1').getMessage())
          One can also drag-and-drop the destination from transformer reference tab.
          Last edited by jkrebs; 07-11-2021, 01:08 PM.

          Comment


          • #6
            Hi guys thank you for your response but both
            var Facilities_Body = $('Facilities_Response1').getMessage()) and channelMap.get('Facilities_Response')

            Below is my use case.

            We are receiving an array of elements in which we are sending each array element to different channel. in the other channel. We are filtering to send request to destination 1 and once we get the response from destination 1, we are adding that in transformer in destination 2 and sending it to HTTP connector.

            Channels are working properly until we get different responses for each array element but destination 2 is not getting the channelMap value set in response filter of destination1.

            Let me know if you need anything else guys and thank you very much for your support

            Regards,
            Naveen

            Comment


            • #7
              Hi Guys,

              thank you for al your inputs. Was able to make it work somehow.

              Regards,
              Naveen

              Comment

              Working...
              X