首页 > 解决方案 > camel ftp2 file throw error when there is no file present in the folder

问题描述

I am working on reading the files from the sftp path and process the plain text files that are kept on the server every 5 hours. There is a requirement where I need to throw an exception when there is no file present/kept on the server by the producer. I am using the following to read the files

from(sftp://NUID@SERVER:PORT?&preferredAuthentications=password&delete=true)
            .routeId(ROUTE_ID)
            .log("${body}")
            .process(processor)
            .end();

Now if there is no file present when the above route starts it doesn't say anything once there is a file on the server it consumes and process it. I want to throw an exception if there is no file present during a period of time.

标签: exceptionapache-camelcamel-ftp

解决方案


您收到的异常是什么?

我检查了文档http://camel.apache.org/ftp2.html,这可能是由于选项未设置为 true 造成的。请再试一次,ignoreFileNotFoundOrPermissionError=true并检查文档中可能适用的其他选项。


推荐阅读