0

我正在尝试在 Camel 2.23.2 中设置自定义 processStrategy。我尝试了几种方法从processStrategy uri 参数中引用它,但我总是得到这个异常:

Caused by: java.lang.IllegalArgumentException: Could not find a suitable setter for property: processStrategy 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.GenericFileProcessStrategy with value #genericFileNoOpProcessStrategy"

路线定义

    <bean id="genericFileNoOpProcessStrategy" class="org.apache.camel.component.file.strategy.GenericFileNoOpProcessStrategy"/>
    <routeContext id="routes" xmlns="http://camel.apache.org/schema/spring">
        <route id="route">
            <from uri="seda:someEvent"/>
            <pollEnrich>
                <constant>file:/folder?fileName=file.csv&amp;processStrategy=#genericFileNoOpProcessStrategy"</constant>
            </pollEnrich>

引用它的正确方法是什么?

4

1 回答 1

0

如果不是用户错误,这将一直有效(注意引号"):

<constant>file:/folder?fileName=file.csv&amp;processStrategy=#genericFileNoOpProcessStrategy"</constant>

固定:

<constant>file:/folder?fileName=file.csv&amp;processStrategy=#genericFileNoOpProcessStrategy"</constant>
于 2021-10-28T14:57:25.483 回答