Apache Camel:我需要让我的 FTP-Consumer 路由交易吗?

2022-01-19 00:00:00 java spring-boot apache-camel

我有这些 FTP 端点属性:

I have these FTP endpoint properties:

include=.*.xml&delay=60s&consumer.bridgeErrorHandler=true&throwExceptionOnConnectFailed=true&binary=true&move=.done&soTimeout=300000

所以端点需要每 60 秒搜索一次 *.xml 文件并使用它.之后,文件将继续并移动到完成"目录中.

So an endpoint need to search every 60 secounds the *.xml files and consume it. After that the files will be proceed and moved in 'done' directory.

恐怕如果 f.e.通过移动文件会发生 IOException,该文件将已从端点根目录中删除.

I'm afraid that if f.e. by doing the move of a file an IOException occures, the file will already be deleted from the endpoint root directory.

问题是:我需要让我的 FTP-Consumer 路由交易吗?

The question is: do I need to make my FTP-Consumer route transactional?

另一个问题是:您能否建议为这种情况添加另一个有用的 ftp 消费者属性?

Another question is: can you give an advise to add another usefull ftp consumer properties for this case?

推荐答案

如果 f.e.通过移动文件会发生 IOException

if f.e. by doing the move of a file an IOException occures

根据 GenericFileEndpoint.java 您可以使用 setMoveFailed() 来定义移动失败时将文件移动到哪里.FTP 端点应继承该选项,请参见此处:FtpEndpoint

According to GenericFileEndpoint.java you can use setMoveFailed() to define where to move the file if the moving fails. The FTP endpoint should inherit that option, see here: FtpEndpoint

我认为您不需要使端点事务性.

I do not think that you need to make you endpoint transactional.

相关文章