# Actor Timer for long running applications?

**URL:** <https://discuss.akka.io/t/actor-timer-for-long-running-applications/7509>\
**Category:** Akka Libraries\
**Tags:** akka, scala\
**Created:** [November 18, 2020, 6:38pm UTC](https://discuss.akka.io/t/actor-timer-for-long-running-applications/7509 "2020-11-18T18:38:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![apetkovic28](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/apetkovic28/32/2096_2.png) [@apetkovic28](https://discuss.akka.io/u/apetkovic28)\
**Post date:** [November 18, 2020, 6:38pm UTC](https://discuss.akka.io/t/actor-timer-for-long-running-applications/7509/1 "2020-11-18T18:38:46Z")

</div>

I apologize if this question or something similar was asked here before. I tried to quickly scan the discussions here, before posting my question.

My question here is related to the Actor Timers. So, going over the documentation here: [https://doc.akka.io/docs/akka/current/scheduler.html](https://doc.akka.io/docs/akka/current/scheduler.html)  
Specifically where it talks about the Scheduler’s limitations " The Akka scheduler is **not** designed for long-term scheduling …The maximum amount of time into the future you can schedule an event to trigger is around 8 months"

The question is does the same or some comparable limitation apply to the Actor Timers too? And, what are other limitations of the Timers? Can it be used in long-running applications, where the timer could run “forever”, assuming the actor itself doesn’t die, because the timer is tied to the Actor lifecycle.

Just an FYI, my intention is to use a long running scheduler or timer system in Actor where it would message itself. I see the akka-quartz-scheduler as an alternative, but in some cases I need something executing at an interval of 100s of milliseconds, which is not supported by the quartz scheduler, it appears. And as far as I know, you can’t tell the quartz scheduler easily or in a nice way to run something every so-and-so minutes, starting now (i.e. dealing with the cron expression dynamically looks yucky)

regards,  
Alex

---

<div class="post-metadata">

**Author:** ![johanandren](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/johanandren/32/85_2.png) [@johanandren](https://discuss.akka.io/u/johanandren)\
**Post date:** [November 19, 2020, 9:25am UTC](https://discuss.akka.io/t/actor-timer-for-long-running-applications/7509/2 "2020-11-19T09:25:08Z")

</div>

The actor timers are backed by the scheduler so the same applies there.

Can’t really recommend on a scheduling solution that covers both short things and cron like but dynamic tasks though. Perhaps just mix both a cron like scheduler and usage of the Akka scheduler/actor timers, or implement a cron-like tool for your specific requirements.

---

<div class="post-metadata">

**Author:** ![apetkovic28](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/apetkovic28/32/2096_2.png) [@apetkovic28](https://discuss.akka.io/u/apetkovic28)\
**Post date:** [November 19, 2020, 8:12pm UTC](https://discuss.akka.io/t/actor-timer-for-long-running-applications/7509/3 "2020-11-19T20:12:40Z")

</div>

Alright, thanks for the clarification!

---

<div class="post-metadata">

**Author:** ![apetkovic28](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/apetkovic28/32/2096_2.png) [@apetkovic28](https://discuss.akka.io/u/apetkovic28)\
**Post date:** [December 15, 2020, 1:43am UTC](https://discuss.akka.io/t/actor-timer-for-long-running-applications/7509/4 "2020-12-15T01:43:20Z")

</div>

A follow up question. If I was to use the quartz cron scheduler that triggers a timer. Would the timer still function properly after 8 months?

Thanks, Alex

---

<div class="post-metadata">

**Author:** ![patriknw](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/patriknw/32/89_2.png) [@patriknw](https://discuss.akka.io/u/patriknw)\
**Post date:** [December 19, 2020, 12:58pm UTC](https://discuss.akka.io/t/actor-timer-for-long-running-applications/7509/5 "2020-12-19T12:58:45Z")

</div>

I wouldn’t trust that it would trigger accuratly after months.
