用骆驼过滤文件名我收到错误

filter on file name with Camel I'm getting an error

我正在尝试使用 apache Camel 的文件名过滤器。 我收到 IllegalArgumentException 类型的错误 - 见下文。 你能给个建议吗?

spring xml :

<bean id="adoFilter" class="calypsox.bllInterfaces.cashMgn.cashMgnAdo.AdoFileFilter"/>
                <camelContext xmlns="http://camel.apache.org/schema/spring"
                                id="cashMgn">
                                <propertyPlaceholder id="cashMgnProperty"
                                                location="${bll.resources.env}/cashMgn.properties" />
                                <route id="cashMgnAdo">
                                                <from
                                                                uri="file:{{cashMgnAdoFileDir}}?filter=#adoFilter;move=.org/${date:now:yyyyMMdd}/${file:name}&amp;readLock=changed&amp;readLockCheckInterval=2000&amp;readLockTimeout=10000&amp;moveFailed=.failed" />
                                                <convertBodyTo type="java.lang.String" />
                                                <to uri="bean:cashMgnHandler?method=handleCashMgnAdo" />
                                </route>

                </camelContext>

java 过滤器 class :

     public class AdoFileFilter<T> implements GenericFileFilter<T> {
                public boolean accept(GenericFile<T> file) {
                                // we want all directories
                                // if (((File) file).isDirectory()) {
                                // return true;
                                // }

                                // we dont accept any files starting with skip in the name
                                return true;// !file.getFileName().startsWith("skip");
                }
}

异常:

Caused by: java.lang.IllegalArgumentException: Could not find a suitable setter for property: filter as there isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: java.lang.String to the required type: org.apache.camel.component.file.GenericFileFilter with value #adoFilter;move=.org/${date:now:yyyyMMdd}/${file:name}

                at org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:341)

                at org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:291)

                at org.apache.camel.util.EndpointHelper.setProperties(EndpointHelper.java:225)

                at org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:200)

                at org.apache.camel.component.file.GenericFileComponent.createEndpoint(GenericFileComponent.java:65)

                at org.apache.camel.component.file.GenericFileComponent.createEndpoint(GenericFileComponent.java:36)

                at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:75)

                at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:432)

                ... 28 more

您必须用 &amp; 分隔查询参数。在您的 filtermove 参数之间是一个分号。