log and set polling time information in exchange header
I have a route like this
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
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