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

Re: log and set polling time information in exchange header


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 <davrossimail@xxxxxxxxx> 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
----------------- @davsclaus
Camel in Action 2: