prakash
prakash

Reputation: 57

RequestHandlerRetryAdvice | Service Activator

I want to block the retry from my of service activator, incase of any exception thrown.

Below is my configuration,

<http:inbound-gateway id="inboundGW"
        request-channel="getCustInfo" supported-methods="GET"
        error-channel="errorHandlerRouterChannel" 
        path="/Messages/{cust}" reply-channel="msgRetrival">
        <http:header name="cust" expression="#pathVariables.cust" />
    </http:inbound-gateway>

<int:service-activator input-channel="getCustInfo"
    output-channel="msgRetrival" ref="createService" method="processCustInfo">
    <int:request-handler-advice-chain>
    <ref bean="retryWithBackoffAdviceSession"></ref>
    </int:request-handler-advice-chain>
</int:service-activator>

<bean id="retryWithBackoffAdviceSession" class="org.springframework.integration.handler.advice.RequestHandlerRetryAdvice">
            <property name="retryTemplate">
                <bean class="org.springframework.retry.support.RetryTemplate">
                      <property name="retryPolicy">
                        <bean class="org.springframework.retry.policy.SimpleRetryPolicy">
                            <property name="maxAttempts" value="1" />
                        </bean>
                    </property>
                </bean>
            </property>
            <property name="recoveryCallback">
                <bean class="org.springframework.integration.handler.advice.ErrorMessageSendingRecoverer">
                    <constructor-arg ref="errorHandlerRouterChannel"/>
                </bean>
            </property>
</bean>

Exception thrown from my service activator doesn't get caught by the error-channel specified in the http:inbound-gateway

Upvotes: 0

Views: 1393

Answers (2)

prakash
prakash

Reputation: 57

Spring integration config file was loaded twice in the deployment descriptor. After fixing this the issue was resolved.

Upvotes: 1

Gary Russell
Gary Russell

Reputation: 174759

Your question is not clear.

If you want to throw the exception after retries are exhausted, remove the recoveryCallback.

Upvotes: 0

Related Questions