You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Simon Martinelli <si...@martinelli.ch> on 2022/08/05 08:42:09 UTC

Timer fixedRate does not work

Hi again,

I tried this:

from("timer://atimer?fixedRate=true&period=1000")
        .routeId("atimer")
        .log("Before")
        .delay(5000)
        .log("After");

No matter if I use fixedRate= true or false the output is in both cases the same and there are multiple route instances running.

What's wrong?

Thanks,
Simmon

AW: Timer fixedRate does not work

Posted by Simon Martinelli <si...@martinelli.ch>.
Thank you!

-----Ursprüngliche Nachricht-----
Von: Claus Ibsen <cl...@gmail.com> 
Gesendet: Freitag, 5. August 2022 10:48
An: users@camel.apache.org
Betreff: Re: Timer fixedRate does not work

You need to force timer to be synchronous mode with synchronous=true then it will automatic block if something runs async in the route.

On Fri, Aug 5, 2022 at 10:45 AM Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> delay is async, it's not blocking.
>
>
> On Fri, Aug 5, 2022 at 10:42 AM Simon Martinelli <si...@martinelli.ch>
> wrote:
>
>> Hi again,
>>
>> I tried this:
>>
>> from("timer://atimer?fixedRate=true&period=1000")
>>         .routeId("atimer")
>>         .log("Before")
>>         .delay(5000)
>>         .log("After");
>>
>> No matter if I use fixedRate= true or false the output is in both 
>> cases the same and there are multiple route instances running.
>>
>> What's wrong?
>>
>> Thanks,
>> Simmon
>>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: Timer fixedRate does not work

Posted by Claus Ibsen <cl...@gmail.com>.
You need to force timer to be synchronous mode with synchronous=true then
it will automatic block if something runs async in the route.

On Fri, Aug 5, 2022 at 10:45 AM Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> delay is async, it's not blocking.
>
>
> On Fri, Aug 5, 2022 at 10:42 AM Simon Martinelli <si...@martinelli.ch>
> wrote:
>
>> Hi again,
>>
>> I tried this:
>>
>> from("timer://atimer?fixedRate=true&period=1000")
>>         .routeId("atimer")
>>         .log("Before")
>>         .delay(5000)
>>         .log("After");
>>
>> No matter if I use fixedRate= true or false the output is in both cases
>> the same and there are multiple route instances running.
>>
>> What's wrong?
>>
>> Thanks,
>> Simmon
>>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: Timer fixedRate does not work

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

delay is async, it's not blocking.


On Fri, Aug 5, 2022 at 10:42 AM Simon Martinelli <si...@martinelli.ch>
wrote:

> Hi again,
>
> I tried this:
>
> from("timer://atimer?fixedRate=true&period=1000")
>         .routeId("atimer")
>         .log("Before")
>         .delay(5000)
>         .log("After");
>
> No matter if I use fixedRate= true or false the output is in both cases
> the same and there are multiple route instances running.
>
> What's wrong?
>
> Thanks,
> Simmon
>


-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2