Hi,

I am new in Apache Camel and have an interesting scenario. Could you please
help me?

My current route looks like this:
(1) mainRoute > timer://xxx?period=10000, to: "direct:apiCaller"
(2) apiCaller > retrieve data from restapi, to: "direct:persistData"
(3) persistData > save data to database

So every x second a restapi is called and the received data is persisted. It
works fine. But I need to call the restapi continuously until it receives an
empty answer in the rest response so I need to do a loop with (2) and (3)
steps. And then if there is no more data at moment then have to wait till
the next timer event is fired to start downloading the newcomer data if we
have.

So my route needs to do this:
(1) route1 > timer://xxx?period=10000, to: "direct:apiCaller"
--> do
(2) apiCaller > retrieve data from restapi, to: "direct:persistData"
(3) persistData > save data to database
--> while (answer of restapi is empty)

My first idea was to reschedule the timer from 1 minutes to 1 sec in case of
I have more data to download. And when we do not have more data to download
then reschedule my timer from 1 sec to 1 min just because of wait till a
little bit.

But I am not able to reschedule the timer runntime so it needs to be some
different solution to handle my use case.

What is the best way to reach my target?




--
View this message in context: 
http://camel.465427.n5.nabble.com/timer-reschedule-loop-between-routes-tp5776017.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to