I am connecting to a GET REST service thorugh http outbound gateway. The following code snippent is from the spring integration XML
<http:outbound-gateway request-channel="dispatcherchannel"
http-method="GET"
url="http://ip:port/cacheAPI/Cache/fetch?employeeNumber={employeeNumber}"
reply-channel="outboundreplychannel"
expected-response-type="com.service.Employees">
<http:uri-variable name="empoyeeNumber" expression="payload"/>
</http:outbound-gateway>
I want to know how to set retry mechanism in this gateway so that if the rest service gives a bad response code like 400/500/404 , the oubound gateway should be able to retry automatically for a particular set number of times till it finally errors out.
Can I get a implemented sample for my reference?
Thanks!
You can handle the response in the reply channel. You can handle it with a service activator, parse the response and then decide for a retry or not. Keep in mind that in the reply channel along with the response is the original message, so you can easily resend.