Routing logic to send to different system based on condition
Groovy Script:
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import groovy.json.*;
import groovy.util.logging.*;
import org.codehaus.*;
import groovy.xml.*;
def Message processData(Message message) {
def body = message.getBody(java.lang.String) as String;
map = message.getProperties();
JobCategory = map.get("JobCategory");
requestid = map.get("requestid");
taskid = map.get("taskid");
message.setProperty("JobCategory1",JobCategory);
message.setProperty("requestid1",requestid);
message.setProperty("taskid1",taskid);
def route1 = "M";
def route2 = "F;
def route3 = "F;
def route4 = "M";
if(JobCategory.equals("03"))
{
if((taskid.equals("")) && (requestid.equals("")))
{
Header = route1;
}
else
{
Header = route2;
}
}
else
{
if((JobCategory.equals("02")) || (JobCategory.equals("01")))
{
Header = route3;
}
else
{
Header = route4;
}
}
message.setProperty("Header",Header);
return message;
}
No comments:
Post a Comment