Sidebar

Can I check IP/port connection status from a mapping node?

0 votes
182 views
asked Mar 24, 2022 by marc-m-6210 (140 points)
I'm trying to set up failover for sending messages, for example if server A is down/not responding then send to server B. Can this be done from a mapping node and then route to the appropriate destination as needed?

Thanks!

1 Answer

0 votes

You can use a try/catch to try the first connection. If it get an error then you will try the second connection in the catch.

message = qie.createJSONMessage('');


var prod1Used = false;
var prod2Used = false;

try{
   // try your connection using qie.callRESTWebService or some other code;
   
   prod1Used = true;
   
}catch(err){
   qie.debug("ERROR:" + err);
   prod1Used = false;
}


if( prod1Used === false ){

   try{
      // try your connection using qie.callRESTWebService or some other code;
      
      prod2Used = true;
      
   }catch(err){
      qie.debug("ERROR:" + err);
      prod2Used = false;
   }

}
 

 

answered Mar 28, 2022 by brandon-w-8204 (33,270 points)
...