Interface TimerScheduler
-
Method Summary
Modifier and TypeMethodDescriptionCompletionStage
<akka.Done> Cancel an existing timer.<I,
O> CompletionStage <akka.Done> startSingleTimer
(String name, Duration delay, int maxRetries, DeferredCall<I, O> deferredCall) Schedule a single timer.<I,
O> CompletionStage <akka.Done> startSingleTimer
(String name, Duration delay, DeferredCall<I, O> deferredCall) Schedule a single timer.
-
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 samename
is registered the previous is cancelled.- Parameters:
name
- unique name for the timerdelay
- delay, starting from now, in which the timer should be triggereddeferredCall
- 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 samename
is registered the previous is cancelled.- Parameters:
name
- unique name for the timerdelay
- delay, starting from now, in which the timer should be triggeredmaxRetries
- Retry up to this many times before giving updeferredCall
- a call to component that will be executed when the timer is triggered
-
cancel
Cancel an existing timer. This completes successfully if not timer is registered for the passed name.
-