文件组件(Apache camel)delete = true参数在Windows中不起作用 [英] File component(Apache camel) delete=true parameter not working in windows

查看:159
本文介绍了文件组件(Apache camel)delete = true参数在Windows中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Apache Camel File组件无法在Windows7中正常工作,就像在Linux中正常工作一样.

The Apache Camel File component not working properly in Windows7, where as its working in Linux without any Problem.

我的要求:

文件处理后,必须从目录中删除文件.在Windows中,由于 .camelLock ,文件无法正确删除.

After the file processing, the files must be deleted from the Directory. In Windows, because of .camelLock the files are not deleting properly.

多次尝试后,只有Apache骆驼才能从目录中删除文件.如果attemt无法从目录中删除文件,则抛出异常.

After Multiple attempts, then only Apache camel can delete the file from the Directory. If the attemt failed to delete the file from the Directory then its throwing an exception.

如果目录中只有一个文件,则可以正常工作,但是如果我有多个文件,则抛出异常.

If I have only a File in the Directory, it's working without any Problem, but if i have multiple Files then it's throwing an Exception.

应用环境:

我在Tomcat服务器中部署了Apache camel应用程序.

I deployed the Apache camel application in Tomcat Server.

Apache Camel版本:2.17.1

Apache Camel version: 2.17.1

Apache Camel路线:

 <from uri="file:///var/opt/irs/message?delete=true" />
 <to uri="direct:file.storage.original" />

在Windows中,我收到以下错误消息:

In Windows I am receiving following Error:

1 | 2017-11-14 17:56:34,828 | 11-01-41 |默认|警告
|是|| o.a.c.c.f.GenericFileOnCompletion | file.analysis.input |错误 在提交期间.交换[ID-51741-1510678404569-9-22].造成原因: [org.apache.camel.component.file.GenericFileOperationFailedException- 无法删除文件:GenericFile [C:\ var \ opt \ irs \ message \ 661.zip]] org.apache.camel.component.file.GenericFileOperationFailedException: 无法删除文件:GenericFile [C:\ var \ opt \ irs \ message \ 661.zip]位于 org.apache.camel.component.file.strategy.GenericFileDeleteProcessStrategy.commit(GenericFileDeleteProcessStrategy.java:89) 在 org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:127)

1|2017-11-14 17:56:34,828|11-01-41|default|WARN
|yes||o.a.c.c.f.GenericFileOnCompletion|file.analysis.input|Error during commit. Exchange[ID-51741-1510678404569-9-22]. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Cannot delete file: GenericFile[C:\var\opt\irs\message\661.zip]] org.apache.camel.component.file.GenericFileOperationFailedException: Cannot delete file: GenericFile[C:\var\opt\irs\message\661.zip] at org.apache.camel.component.file.strategy.GenericFileDeleteProcessStrategy.commit(GenericFileDeleteProcessStrategy.java:89) at org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:127)

类似问题: 骆驼2.14 .2不删除Windows上的文件删除移动文件

推荐答案

在这种情况下,我忘记了关闭文件输入流.因此,这就是我在Windows中遇到问题的原因.

In this case, I forgot to close file input stream. so that's why I had a problem in Windows.

我不必要地对Filecomponent使用InputStream.我删除了所有工作文件.

I am using InputStream unnecessarily for the Filecomponent. I removed it, everything working file.

InputStream input = CamelContextHelper.convertTo(context, InputStream.class, body);

如果有人遇到相同的问题,只需正确关闭文件InputStream或交叉检查您的代码,然后尝试用其他适当的替代解决方案替换它.

If anybody has same problem, just close the file InputStream properly or Cross-check your code and try to replace it with other proper alternative solution.

替代解决方案:

以防万一,如果您无法在代码中找到打开的流,请将以下参数应用于Apache骆驼路线.性能会更好.

In case,if you are unable to find open streams in your code, then apply below parameters to Apache camel route. The performance would be better.

readLockCheckInterval=1&amp;readLockTimeout=3

就我而言,在Windows中的性能要好得多.

In my case Performance much better in windows.

这篇关于文件组件(Apache camel)delete = true参数在Windows中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆