1.2k questions

1.4k answers

361 comments

339 users

Categories

Sidebar
0 votes
300 views
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;
   }

}
 

 

by brandon-w-8204 (34.1k points)
...