[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

.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

.to("bean:myHeaderProcessor") <-- this logs and create my header
.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