RequestHandlerRetryAdvice |服务激活器

时间:2014-12-18 20:40:29

标签: spring-integration

我希望阻止来自我的服务激活器的重试,因为任何异常都会被抛出。

以下是我的配置

<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>

我的服务激活器抛出的异常不会被http:inbound-gateway

中指定的错误通道捕获

2 个答案:

答案 0 :(得分:1)

Spring集成配置文件在部署描述符中加载了两次。解决此问题后,问题就解决了。

答案 1 :(得分:0)

你的问题不明确。

如果要在重试耗尽后抛出异常,请删除recoveryCallback