Interface TimerScheduler


public interface TimerScheduler
  • Method Details

    • startSingleTimer

      <I, O> CompletionStage<akka.Done> startSingleTimer(String name, Duration delay, DeferredCall<I,O> deferredCall)
      Schedule a single timer. Timers allow for scheduling calls in the future. For example, to verify that some process have been completed or not.

      Timers are persisted and are guaranteed to run at least once.

      When a timer is triggered, the scheduled call is executed. If successfully executed, the timer completes and is automatically removed. In case of a failure, the timer is rescheduled with an exponentially increasing delay, starting at 3 seconds with a max delay of 30 seconds. This process repeats until the call succeeds.

      Each timer has a name and if a new timer with same name is registered the previous is cancelled.

      Parameters:
      name - unique name for the timer
      delay - delay, starting from now, in which the timer should be triggered
      deferredCall - a call to component that will be executed when the timer is triggered
    • startSingleTimer

      <I, O> CompletionStage<akka.Done> startSingleTimer(String name, Duration delay, int maxRetries, DeferredCall<I,O> deferredCall)
      Schedule a single timer. Timers allow for scheduling calls in the future. For example, to verify that some process have been completed or not.

      Timers are persisted and are guaranteed to run at least once.

      When a timer is triggered, the scheduled call is executed. If successfully executed, the timer completes and is automatically removed. In case of a failure, the timer is rescheduled with a delay of 3 seconds. This process repeats until the call succeeds or the maxRetries limit is reached.

      Each timer has a name and if a new timer with same name is registered the previous is cancelled.

      Parameters:
      name - unique name for the timer
      delay - delay, starting from now, in which the timer should be triggered
      maxRetries - Retry up to this many times before giving up
      deferredCall - a call to component that will be executed when the timer is triggered
    • cancel

      CompletionStage<akka.Done> cancel(String name)
      Cancel an existing timer. This completes successfully if not timer is registered for the passed name.