Search code examples
javaapache-camelspring-camel

Need clarity on Camel Timer component timely processing


In Apache Camel, I have configured the timer component to fire the job for every 15 mins. Suppose if any job which is taken more than 15 mins due to data load to complete it task, will it be affected by the next job since we have configured to run job for every 15 mins.


Solution

  • As Claus already commented, the option fixedRate of the Camel Timer component controls this. The term fixedRate refers to the same term of Javas ScheduledExecutorService.

    The default is fixedRate=false. That means the Timer uses fixed-delay execution of the ExecutorService. For example

    delay=30000&period=60000&fixedRate=false
    

    means that the task runs for the first time 30s after starting. After that a new task starts 60s after the previous task has finished. The task can never overlap.

    In contrast, fixedRate=true switches to fixed-rate execution of the ExecutorService. For example

    delay=30000&period=60000&fixedRate=true
    

    means that the task runs for the first time 30s after starting. After that every 60s a new task is started, no matter how long the tasks are running. So in this setup the tasks can overlap.