Hi See a bit here http://camel.apache.org/batch-consumer.html
Also there is runLoggingLevel you can turn up|down, however its logging a fixed message but it logs each time the scheduler runs On Mon, Mar 5, 2018 at 5:01 PM, Claus Ibsen <claus.ib...@gmail.com> wrote: > Hi > > You can use the filter EIP and then filter on when the file batch is complete. > You already have a timestamp on the exchange when it was created so > you can grab that. > > And mind this will only trigger when there are files, if there is no > files then the route is not executed. > You can then turn on the sendEmptyMessageWhenIdle to trigger a "empty > message". > > > > On Mon, Mar 5, 2018 at 4:45 PM, Davide Rossi <davrossim...@gmail.com> wrote: >> Hi, Claus >> thanks for your quick reply. If I correctly understood what you said, you >> propose to use something like this >> >> from("file://C:\\path\\to\\sourceDirectory?delay=10000&directoryMustExist=true").routeId("myRouteId") >> .log(LoggingLevel.INFO, "it.package.MyLogProcessor", [here the msg]) >> .to("bean:myProcessor") >> .to("file://C:\\path\\to\\targetDirectory"); >> >> But, doing like that will produce a log for each exchange created during >> one poll. >> Actually, I need something different, because I don't want a log for each >> exchange, but one for each executed polling (in this route example, one log >> each 10 sec). So, in my log file, I want something like: >> 2018-03-05 11:10:20,722 .... Route with id 'myRouteId' scheduled on >> 05/03/2018 at 11:10:20 >> 2018-03-05 11:10:30,722 .... Route with id 'myRouteId' scheduled on >> 05/03/2018 at 11:10:30 >> 2018-03-05 11:10:40,722 .... Route with id 'myRouteId' scheduled on >> 05/03/2018 at 11:10:40 >> >> Besides the custom log, for each exchange created during a poll, I need to >> set an header composed by routeId and polling time. So this header should >> be the same for all the exchanges created at one polling time. Here is an >> example. >> When file consumer poll directory on 05/03/2018 at 11:10:20 -> all the >> exchanges must have header "myHeader":"myRouteId_05/03/2018T11:10:20" >> When file consumer poll directory on 05/03/2018 at 11:10:30 -> all the >> exchanges must have header "myHeader":"myRouteId_05/03/2018T11:10:30" >> and so on. >> >> Because of these two requirements, I was thinking of doing both actions in >> one class/processor because, as you can imagine, I need to have just the >> same time in the log and in my custom header. >> I hope this explains better my requirements. >> >> Thanks again >> Davide >> >> 2018-03-05 12:10 GMT+01:00 Claus Ibsen <claus.ib...@gmail.com>: >> >>> Hi >>> >>> Do like the first, dont use pollEnrich. >>> >>> So can you be more clean what you mean by n-th polling. So you set it >>> to poll every 10 seconds. Do you want a log for each of those? >>> Then just use the Log EIP >>> >>> >>> >>> On Mon, Mar 5, 2018 at 11:25 AM, Davide Rossi <davrossim...@gmail.com> >>> wrote: >>> > Hi everyone! >>> > I have a route like this >>> > >>> > >>> > >>> > >>> > >>> > *from("file://C:\\path\\to\\sourceDirectory?delay=10000& >>> directoryMustExist=true").routeId("myRouteId") >>> > .to("bean:myProcessor") .to("file://C:\\path\\to\\targetDirectory");* >>> > Now, I need this: >>> > - when the i-th polling happens, I want to have a cutom log reporting >>> > routeId and polling time (sthg like "Route with id 'myRouteId' scheduled >>> at >>> > 05/03/2018 at 11:10:20" ) >>> > - each time a polling happens, I want to set an header for all the >>> > exchanges created. This header contains routeId and the same polling time >>> > reported above (so sthg like, 'myRouteId_ 05/03/2018T11:10:20 '). So this >>> > header should be the same for all the exchanges created at one polling >>> > time, but different from the one created at a different polling time. >>> > >>> > I have looked around but I wasn't able to find what just occurrs to me >>> > using file component only. >>> > So I tried to change the route like this >>> > >>> > >>> > >>> > >>> > >>> > *from("timer://foo?period=10000").routeId("myRouteId") >>> > .to("bean:myHeaderProcessor") <-- this logs and create my header >>> > .pollEnrich("file://C:\\path\\to\\sourceDirectory? >>> directoryMustExist=true") >>> > .to("bean:myProcessor") .to("file://C:\\path\\to\\targetDirectory");* >>> > >>> > This second solution seems to be ok but unfortunately the pollEnrich >>> > doesn't get all the files in the sourceDirectory but only one at a time. >>> > >>> > So, is there another possible soultion? >>> > Thank you very much >>> > Davide >>> >>> >>> >>> -- >>> Claus Ibsen >>> ----------------- >>> http://davsclaus.com @davsclaus >>> Camel in Action 2: https://www.manning.com/ibsen2 >>> > > > > -- > Claus Ibsen > ----------------- > http://davsclaus.com @davsclaus > Camel in Action 2: https://www.manning.com/ibsen2 -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2