同时拉入多个文件

时间:2016-08-31 07:44:45

标签: java xml apache-camel

这是在特定文件夹中使用Apache Camel FrameWork编写文件的示例。

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="
   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
   http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

<camelContext xmlns="http://camel.apache.org/schema/spring">
    <route>
        <from uri="file:src/data?noop=true"/>
        <loop>
            <constant>10000</constant>
            <to uri="file://src/data/out?fileName=${date:now:yyyymmddhhmmss}.LOOP.${header.CamelLoopIndex}.txt"/>
        </loop>
    </route>
</camelContext>

此示例并不代表我的使用情况。 目标是从第一个文件开始创建多个文件,每次都使用这些文件同时创建的约束更改文件名。

有没有办法同时写入所有文件?当循环处理时 结束,有没有办法一次调用写文件?

Thxs。

1 个答案:

答案 0 :(得分:1)

您可以使用<threads>同时处理文件。当<threads>被命名为<async>时,我的旧博客条目:http://www.davsclaus.com/2009/05/on-road-to-camel-20-concurrency-with.html

使用循环没有意义,只会保持循环同一个文件。

相关问题