Spring integration spring集成:入站通道适配器。抓住一个例外

Spring integration spring集成:入站通道适配器。抓住一个例外,spring-integration,Spring Integration,我实现了一个sftp入站通道适配器,当处理异常时,我应该显示一条定制消息 我试过: <int-sftp:inbound-channel-adapter id="sftpInbondAdapter" auto-startup="true" channel="receiveChannel" session-factory="sftpSessionFactory" local-directory="file:${directory.files.local}" remote-dir

我实现了一个sftp入站通道适配器,当处理异常时,我应该显示一条定制消息

我试过:

<int-sftp:inbound-channel-adapter id="sftpInbondAdapter"
    auto-startup="true" channel="receiveChannel" session-factory="sftpSessionFactory"
    local-directory="file:${directory.files.local}" remote-directory="${directory.files.remote}"
    auto-create-local-directory="true" delete-remote-files="true"  
    filename-pattern="*.txt" >
    <int:poller fixed-delay="${sftp.interval.request}"
        max-messages-per-poll="-1" />

<int-sftp:request-handler-advice-chain>

<bean: class="org.springframework.integration.handler.advice.ExpressionEvaluatingRequestHandlerAdvice">

<property name="onSuccessExpression" value="payload" />
<property name="successChannel" ref="afterSuccessDeleteChannel" />
<property name="onFailureExpression" value="payload.renameTo(new java.io.File(payload.absolutePath + '.failed.to.send'))" />
<property name="failureChannel" ref="afterFailRenameChannel" />
</bean>
</int-sftp:request-handler-advice-chain>

但是一个元素


不接受。您能解释另一种解决方案吗?

请求处理程序的建议是针对某个下游组件的,而不是针对入站通道适配器的

您可以向
元素添加
错误频道。发送到错误通道的消息将是
ErrorMessage
,例外情况为有效负载。如果是下游流上的异常,则有效负载将是具有
failedMessage
cause
属性的
MessaginException

添加一些组件以使用错误消息