I want to make http outbound gateway call with retry condition. The outbound gateway will retry until the rest API that i have return ERROR or COMPLETE.
What i do is:
<int-http:outbound-gateway request-channel="checkJobChannel"
url="http://host/rest/job-status"
http-method="GET"
extract-request-payload="true"
expected-response-type="java.lang.String"
reply-timeout="10000"
reply-channel="checkJobChannel.reply"
auto-startup="true"
transfer-cookies="true">
then the router
@Router(inputChannel = "checkJobChannel.reply",applySequence = "true")
public String pointJob(Message<?>reply) {
String returnChannel ="";
if(reply.getPayload().get("status").equals("RUNNING")){
returnChannel="checkJobChannel";
}else if(reply.getPayload().get("status").equals("COMPLETE")|reply.getPayload().get("status").equals("ERROR")){
returnChannel="nextChannel";
}
return returnChannel;
}
Can I do like that? Thanks. What the simple way to achieve that?