Spring Integration - 默认的异常通道实现

时间:2015-03-18 10:30:27

标签: spring spring-integration

我是Spring集成的新手。作为我的任务之一,我应该为管道中的任何故障提供默认的错误处理机制。

我有一个文件入站通道适配器作为起点我按如下方式编写:

<int-file:inbound-channel-adapter id="inbound.jms.adapter" 
     directory="C:\Test
     channel="testChannel"
     auto-startup="false">
     <int:poller fixed-rate="1000" error-channel="default-error-channel" />
</int-file:inbound-channel-adapter>

该频道将由不同的组件进一步使用。

我的问题是,如果进一步失败,异常会回退到默认错误频道吗?

1 个答案:

答案 0 :(得分:0)

  

我的问题是,如果进一步失败,异常会回退到默认错误频道吗?

不,不完全。如果您的下游是direct(仅由DirectChannel s组成),那么是:所有异常将被抛出到第一个轮询通道适配器上的default-error-channel

但是如果将消息转移到不同的频道(QueueChannelExecutorChannel),则会通过其机制处理异常。在大多数情况下,它是Spring Integration的默认errorChannel

查看更多信息here

此外,还有ExpressionEvaluatingRequestHandlerAdvice具有特定端点的异常处理功能。