start a route at the end of another

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

start a route at the end of another

ziller
Hello,

i have a route that reads a directory and process a number of files
contained in this directory.
i would like to log the number of files at the end of the processing of
the directory.

i tried to use oncompletion but it's called for each file.

any idea on how to do that?

thanks in advance
Reply | Threaded
Open this post in threaded view
|

Re: start a route at the end of another

Willem.Jiang
Administrator
Hi  
The pulled files are processed one by one, so you camel route doesn't know who many files are processed.
But you should be able to access the Exchange property like  
Exchange.BATCH_INDEX, Exchange.BATCH_SIZE, Exchange.BATCH_COMPLETE in the onCompletion method.
Then you can write some log for it.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Thursday, December 20, 2012 at 5:24 AM, Olivier Ziller wrote:

> Hello,
>  
> i have a route that reads a directory and process a number of files  
> contained in this directory.
> i would like to log the number of files at the end of the processing of  
> the directory.
>  
> i tried to use oncompletion but it's called for each file.
>  
> any idea on how to do that?
>  
> thanks in advance  


Reply | Threaded
Open this post in threaded view
|

Re: start a route at the end of another

ziller
Hello,

thanks, i will try that

best regards