camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Camel file component URI dynamic options & Filter query
Date Thu, 28 Jan 2016 07:58:35 GMT
You can use a singleton java bean to store the state of that sequence
and then in the file route use that in a file filter to only pickup
the correct file.

You can implement a custom file filter, using the filter option, where
you can then access that singleton bean to get that sequence number.
The other route can then also call that singleton bean where it can
update the sequence.


On Wed, Jan 27, 2016 at 10:34 PM, Felix Thomas <felix.thomas@gmail.com> wrote:
> hello,
>
>     I am trying to make a scenario execute using Camel Spring DSL .
>
>     My idea is to processing some files in a numerical seq order  from a
> folder ,  after processing a file I need to check for the next file
> sequence which need to be processed from DB.
>     The logic of get the next sequence is okay but i am not sure how do i
> pass this information to another route to process that single file only . I
> though about using sequencer etc. but it does not seem fitting it. The only
> option i see is using File Filter .
>      But how do I pass this information to a another route  . For example I
> have to test  below approach(Not sure if its right way to go).
>
>
>    I tried the UserCSVTODB route just to test , the filter worked fine  but
> the other files also got moved to the complete folder. I expected that only
> the matched file in filter should be moved and not others. Is there any way
> I can make this happen , so in the next run it picks
>   the next sequence file . (probably I need to loop back which is another
> question )
>
>
> <route shutdownRunningTask="CompleteCurrentTaskOnly" id="1">
>     <from uri="direct:start"/>
>    <setHeader headerName="filename">
>     <simple>data.4.csv</simple>  (this will be replaced which a processor
> or bean call)
>   </setHeader>
>       <to uri="UserCSVToDB"/>
>   </route>
>
>
> <route shutdownRunningTask="CompleteCurrentTaskOnly" id="UserCSVToDB">
>     <from
> uri="file:///C:\FS\processing?readLock=true&amp;charset=utf-8&amp;move=C:\FS\complete"/>
>    <filter>
>        <simple>${in.header.CamelFileName} == 'data.4.csv'</simple>
>        <to uri="mock:result"/>
>    </filter>
>  </route>
>
>
>
> regards,
> Felix



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Mime
View raw message