Interface BackOffTimerFactory


public interface BackOffTimerFactory
SPI factory for creating BackOffTimer instances used to schedule retry or back-off tasks.

A BackOffTimer drives retries described by a BackOff policy (fixed delay, exponential back-off, max elapsed time, etc.) using a ScheduledExecutorService as the underlying scheduler. Camel's SupervisingRouteController uses back-off timers to schedule route restart attempts after failure.

The two factory methods cover the common cases: obtain a timer that manages its own scheduler via newBackOffTimer(String), or supply an externally managed scheduler via newBackOffTimer(String, java.util.concurrent.ScheduledExecutorService) to share thread pool resources. The timer must be started and stopped through its service lifecycle.

See Threading Model in the Camel user manual.

Since:
4.13
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.camel.util.backoff.BackOffTimer
    Creates a new BackOffTimer.
    org.apache.camel.util.backoff.BackOffTimer
    Creates a new BackOffTimer using the given executor service.
  • Method Details

    • newBackOffTimer

      org.apache.camel.util.backoff.BackOffTimer newBackOffTimer(String name)
      Creates a new BackOffTimer. Important: The timer should be started and stopped to control its lifecycle by using ServiceHelper.
      Parameters:
      name - logical name of the timer
      Returns:
      new empty backoff timer
    • newBackOffTimer

      org.apache.camel.util.backoff.BackOffTimer newBackOffTimer(String name, ScheduledExecutorService scheduler)
      Creates a new BackOffTimer using the given executor service. Important: The timer should be started and stopped to control its lifecycle by using ServiceHelper.
      Parameters:
      name - logical name of the timer
      scheduler - thread pool to use for running tasks
      Returns:
      new empty backoff timer