Spring integration 在抛出异常表单ChannelInterceptor后未识别errorChannel
我试图从ChennelInterceptor抛出一些异常。但它没有将消息发送到我定义的ErrrorChannel 下面是代码片段Spring integration 在抛出异常表单ChannelInterceptor后未识别errorChannel,spring-integration,Spring Integration,我试图从ChennelInterceptor抛出一些异常。但它没有将消息发送到我定义的ErrrorChannel 下面是代码片段 <int-file:inbound-channel-adapter id="fileInBound" channel="fileProcessingChannel" directory="${file.processing.folder}" prevent-duplicates="tr
<int-file:inbound-channel-adapter id="fileInBound"
channel="fileProcessingChannel"
directory="${file.processing.folder}"
prevent-duplicates="true"
filename-pattern="*.txt">
</int-file:inbound-channel-adapter>
<int:channel id="fileProcessingChannel">
<int:queue/>
</int:channel>
<!--Setting the Error Channel -->
<int:header-enricher input-channel="inputchannel" output-channel="testChannel">
<int:error-channel ref="myErrorChannel" overwrite="true"></int:error-channel>
</int:header-enricher>
<!-- Accepts only the File data Type -->
<int:channel id="testChannel" >
<int:interceptors>
<bean class="com.abc.SomeValidationInterceptor"></bean>
</int:interceptors>
</int:channel>
<int:channel id="myErrorChannel">
</int:channel>
<int:service-activator input-channel="myErrorChannel" output-channel="nullChannel">
<bean class="com.abc.MyErrorHandlerEndpoint"></bean>
</int:service-activator>
我正在从com.abc.SomeValidationInterceptor.引发异常,即MessaginException,我希望到达myErrorChannel,但它无法到达myErrorChannel
知道它为什么不起作用吗?提前谢谢。它不起作用。通常,您不应该自己操作
errorChannel
头,除非是在非常特殊的情况下
您是如何将消息传送到inputChannel
的
通常,您应该使用某种网关,并在其上声明一个错误通道
;让框架处理头文件;网关捕获异常,并正确路由ErrorMessage
类似地,可以在轮询器上为轮询的端点定义
错误通道。请参阅参考手册中的更多信息:谢谢Gary。实际上,我正在处理文件格式file:inbound channel adater。我已在原始帖子中更新了配置信息。