应用 ExpressionEvaluatingRequestHandlerAdvice 是否会抑制错误?

Does applying ExpressionEvaluatingRequestHandlerAdvice supress the error?

适配器外出到 jms 队列。我有一些逻辑需要在成功交付和故障转移时触发,所以我将适配器连接到 ExpressionEvaluatingRequestHandlerAdvice。

<jms:outbound-channel-adapter id="101Out" 
                              channel="101DestinationChannel"
                              connection-factory="101Factory"
                              destination-expression="headers.DESTINATION_NAME"
                              destination-resolver="namingDestinationResolver"
                              explicit-qos-enabled="true">
    <jms:request-handler-advice-chain>
        <beans:bean class="org.springframework.integration.handler.advice.ExpressionEvaluatingRequestHandlerAdvice">
            <beans:property name="onSuccessExpression" ref="success"/>
            <beans:property name="successChannel" ref="normalOpsReplicationChannel"/>
            <beans:property name="onFailureExpression" ref="failure"/>
            <beans:property name="failureChannel" ref="failoverInitiationChannel" />
        </beans:bean>
        <beans:bean id="retryAdvice" class="org.springframework.integration.handler.advice.RequestHandlerRetryAdvice">>
            <beans:property name="retryTemplate" ref="retryTemplate"/>
        </beans:bean>
    </jms:request-handler-advice-chain>       
</jms:outbound-channel-adapter>

现在这两种方法都正确触发并且 replication/failover 逻辑执行良好。但是一旦失败(当我停止队列管理器时),一旦连接到 failureChannel 的进程完成,我看到错误正在传播回调用源(在本例中为 HTTP 端点)。

该建议应该可以阻止错误传播,对吗?

    <service-activator input-channel="failoverInitiationChannel"
        ref="failoverInitiator" />

我有一个连接到 failureChannel 的服务激活器,它只是改变了一个单例。我在这里所做的任何事情都不会触发错误。此外,返回的错误肯定是队列访问,所以它不可能是我在 failoverInitiator 激活后所做的任何事情。

org.springframework.jms.IllegalStateException: JMSWMQ0018: Failed to connect to queue manager 'APFDEV1' with connection mode 'Client' and host name 'localhost(1510)'.

如果我应该使用 RequestHandlerRetryAdvice 上的 recoveryCallback 或这个来实际停止错误,我感到非常困惑。但我确实需要在成功时采取行动,因此 ExpressionEvaluatingAdvice 更适合我的情况。

提前感谢您的帮助:-)

这是默认行为。请参阅 ExpressionEvaluatingRequestHandlerAdvice javadocs trapException 属性...

/**
 * If true, any exception will be caught and null returned.
 * Default false.
 * @param trapException true to trap Exceptions.
 */
public void setTrapException(boolean trapException) {
    this.trapException = trapException;
}

我会在参考手册中添加注释。