骆驼处理器不以拆分器模式工作

Camel Processor not working in a Splitter pattern

我有一条 Camel 路线,稍微简化后,可以归结为以下路线:

<bean id="myProcessor" class="com.acme.MyProcessor" />
<camelContext xmlns="http://camel.apache.org/schema/spring">

    <route>
        <from
            uri="file:/home/inbox?fileName=file.txt&amp;noop=true" />
        <split>
            <tokenize token="@" />
            <process ref="myProcessor" />
        </split>

        <to
            uri="file:/home/outbox" />
    </route>
</camelContext>

令我惊讶的是,我发现即使正在调用处理器,它也无法更改单个标记。例如:

public class MyProcessor implements Processor {

    public void process(Exchange exchange) throws Exception {

        String myString = exchange.getIn().getBody(String.class);
        exchange.getIn().setBody(myString.toUpperCase());

    }
 }

最后,处理器不会更改使用令牌生成的文件。为什么?

尝试像这样修改您的路线:

<route>
    <from
        uri="file:/home/inbox?fileName=file.txt&amp;noop=true" />
    <split>
        <tokenize token="@" />
        <process ref="myProcessor" />
        <to uri="file:/home/outbox?fileExist=Append" />
    </split>
</route>

恕我直言,您拆分了文件,用处理器对其进行了处理,与结果没有任何关系。