Karthik Mannepalli
Karthik Mannepalli

Reputation: 63

Spring Integration HTTP Outbound Gateway Retry on Exception

I am new to Spring Integration. Below given is my code.

<int-jms:message-driven-channel-adapter
    id="testListenter" destination-name="testQueue"
    channel="setTestHeader" concurrent-consumers="2"
    max-concurrent-consumers="5" connection-factory="amqConnectionFactory" />

<http:outbound-gateway request-channel="httpChannel"
    url="http://APITesting/testHttp/v1.0" http-method="POST"
    header-mapper="headerMapper" reply-channel="response.header.enricher"
    error-handler="testErrorHandler"
    expected-response-type="com.test.domain.response.responseObject" message-converters="messageConverters" />

<util:list id="messageConverters">
    <bean id="formHttpMessageConverter" class="org.springframework.http.converter.FormHttpMessageConverter"/>
    <bean id ="mappingJackson2HttpMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>
</util:list>

I am not seeing any exceptions in my logs.

Now I am expecting the response to be a JSON. But If the response is not JSON and is of type raw, the outbound gateway is being fired atleast 7 times automatically.

Any help as why the API is being fired in case of scenarios like this?

Upvotes: 1

Views: 784

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121177

Well, since you don't have any RequestHandlerRetryAdvice there for that <http:outbound-gateway>, that " atleast 7 times automatically" is fully depends on the upstream caller. For example JMS Message Driver Channel Adapter makes a redelivery of the same message, if there is some exception is downstream.

The same we have with the AMQP.

So, "what is in your wallet?"

Please, share DEBUG logs for the org.springframework.integration category when you are observing the retry behavior.

Upvotes: 0

Related Questions