我需要轮询目录并使用不区分大小写的表达式缩小文件范围。
在 2.10 版本中,camel 添加了对 antInclude 的支持,这正是我所研究的,不幸的是 antIninclude 区分大小写,其他过滤表达式也是如此。实现 GenericFileFilter 不是一个选项,因为过滤模式在编译时是未知的,因为我在运行时从数据库读取它们,并且我有多个文件规则,每个规则都有不同的模式。
我以编程方式在循环中创建多个路由,其中每个文件路由都有不同的不区分大小写的过滤模式。如果camel文件组件支持不区分大小写的表达式,我将不胜感激,或者是否有其他方法无需在camel中创建自己的新文件组件?
public class MyRouter extends RouteBuilder {
@Override
public void configure() throws Exception {
Vector<FileTransferEntity> list = TransferDAO.getTransferList();
for(FileTransferEntity t : list) {
fromF("ftp://ftpuser@ftpserver/some-directory?antInclude=%s", t.getFileMask()).
toF("mock:result");//depending on t, action will change.
}
}
I need to poll a directory and narrow the files with a case insentive expression.
With version 2.10 camel adds support for antInclude which is what I look into, unfortunately antInclude is case sensitive, so are other filtering expressions. Implementing GenericFileFilter is not an option, since the filtering patterns are not known at compile time as I read them from database at runtime and I have multiple file rules each with a different pattern.
I programmatically create several routes in a loop, where each file route has a different case insensitive filtering pattern. I would appreciate if camel file component supports case insensitive expressions, or is there any other way without creating myself a new file component in camel?
public class MyRouter extends RouteBuilder {
@Override
public void configure() throws Exception {
Vector<FileTransferEntity> list = TransferDAO.getTransferList();
for(FileTransferEntity t : list) {
fromF("ftp://ftpuser@ftpserver/some-directory?antInclude=%s", t.getFileMask()).
toF("mock:result");//depending on t, action will change.
}
}
发布评论
评论(1)
应该能够使用自定义过滤器...请参阅 camel-file2 了解信息或查看此例如...
https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerFileFilterTest.java
should be able to use a custom filter instead...see camel-file2 for information or see this example...
https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerFileFilterTest.java