2

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.

INDRAJITH EKANAYAKE
  • 3,894
  • 11
  • 41
  • 63
Pearl
  • 384
  • 1
  • 8
  • 15
  • What is "Spring Camel"? Is your job a Spring Batch job? Are you scheduling your job with [Camel's scheduler](http://camel.apache.org/scheduler.html)? Please provide more details about your config to be able to help you. – Mahmoud Ben Hassine May 08 '19 at 08:08
  • Hi @MahmoudBenHassine, I have updated the question. This is not related to Spring batch or Camel's scheduler. This is about Apache Camel's timer component. – Pearl May 08 '19 at 09:59
  • "This is not related to Spring batch": in that case, you can remove the spring-batch tag. – Mahmoud Ben Hassine May 08 '19 at 10:02
  • sure. I did. Thanks! – Pearl May 08 '19 at 11:32
  • There is an option on the timer component to control that, I think its the fixedRate, its from the JDK Timer so you can also find out more about how that works but reading about the JDK Timer - https://github.com/apache/camel/blob/master/components/camel-timer/src/main/docs/timer-component.adoc – Claus Ibsen May 08 '19 at 12:23

1 Answers1

3

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.

burki
  • 6,741
  • 1
  • 15
  • 31
  • Thanks @burki. So, i hope fixedRate=false is a feasible solution. Since it's won't overlap (or) interfere the execution of the job. Am i correct? – Pearl May 09 '19 at 12:54
  • Yes that should work without overlaps – burki May 09 '19 at 14:15