Apache骆驼无法引发ftp连接错误的异常

问题描述

这是我的路线:

        onException(Exception.class)
                .process(reconciliationExceptionProcessor)
                .log(LoggingLevel.INFO,DOCUMENT_RECONCILIATION_ROUTE,"reconciliationExceptionProcessor")
                .handled(true)
//                .maximumRedeliveries(3).redeliveryDelay(0)
                .to(SEND_MAIL_FOR_Failed)
                .end();


  from(GET_FILE_FROM_SFTP)
                .log(LoggingLevel.INFO,"Getting the file from SFTP")
                .pollEnrich()
                .simple("${exchangeProperty.sftpExpression}")
                .to(SAVE_RECEIVED_IDS)
                .end();

  from(SAVE_RECEIVED_IDS)
                .log(LoggingLevel.INFO,"Saving the received IDs")
                .process(saveReceivedsProcessor)

我尝试过这种表达方式:

t&autocreate=false&strictHostKeyChecking=no&preferredAuthentications=publickey,password&throwExceptionOnConnectFailed=true&bridgeErrorHandler=true 

但是当无法建立SFTP连接时,仍然不能排除异常。

在测试机上,它挂起。但是在我的计算机上,它转到下一条路线,所以我看到了该日志:

"Saving the received IDs"

但是在内部,因为file为null,所以它将为文件抛出null指针异常。但是我希望它无法连接到ftp。

我正在使用该版本:

2.18.1

我应该超时吗?

timeout
Timeout in millis when polling from the external service. The timeout has influence about the poll enrich behavior. It basically operations in three different modes: negative value - Waits until a message is available and then returns it. Warning that this
 method Could block indefinitely if no messages are available. 0 - Attempts to receive a message exchange immediately without waiting and returning null if a message exchange is not available yet. positive value - Attempts to receive a message exchange,waiting
 up to the given timeout to expire if a message is not yet available. Returns null if timed out The default value is -1 and therefore the method Could block indefinitely,and therefore its recommended to use a timeout value

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)