git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

log and set polling time information in exchange header


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


( ! ) Warning: include(msgfooter.php): failed to open stream: No such file or directory in /var/www/git/apache-camel-users/msg03103.html on line 106
Call Stack
#TimeMemoryFunctionLocation
10.0007364600{main}( ).../msg03103.html:0

( ! ) Warning: include(): Failed opening 'msgfooter.php' for inclusion (include_path='.:/var/www/git') in /var/www/git/apache-camel-users/msg03103.html on line 106
Call Stack
#TimeMemoryFunctionLocation
10.0007364600{main}( ).../msg03103.html:0