You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kikou1984 <hi...@atos.net> on 2016/08/31 08:57:50 UTC

Pulling multiple files in simultaneously

Hi,

Here an example for writing files Using Apache Camel FrameWork in a specific
folder.

<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>

Is there a way to write all files simultaneously ? When the Loop processing
ends, is there a way to invoke writing files in one time ?

Thxs.



--
View this message in context: http://camel.465427.n5.nabble.com/Pulling-multiple-files-in-simultaneously-tp5787036.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Pulling multiple files in simultaneously

Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
Would something like this work?  I’m not sure how far you can push the concurrentConsumers for SEDA though.

<camelContext xmlns="http://camel.apache.org/schema/spring">
    <route>
        <from uri="file:target/data/in?noop=true"/>
        <loop>
            <constant>1000</constant>
            <to uri="seda://write-file" />
        </loop>
    </route>

    <route>
        <from uri="seda://write-file?blockWhenFull=true&amp;concurrentConsumers=50"/>
        <log message="Writing File ${header[CamelLoopIndex]}" />
        <delay>
            <constant>1000</constant>
        </delay>
        <to uri="file://target/data/out?fileName=${date:now:yyyymmddhhmmss}.LOOP.${header.CamelLoopIndex}.txt"/>
    </route>
</camelContext>


> On Aug 31, 2016, at 2:57 AM, kikou1984 <hi...@atos.net> wrote:
> 
> <camelContext xmlns="http://camel.apache.org/schema/spring <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 <file://src/data/out?fileName=${date:now:yyyymmddhhmmss}.LOOP.${header.CamelLoopIndex}.txt>"/>
>        </loop>
>    </route>
> </camelContext>