scheduler: new instance per run or long-lived actor?

66 views
Skip to first unread message

Александр Семибратов

unread,
Feb 22, 2018, 2:25:48 AM2/22/18
to Akka User List
Hi

I want to implement task scheduler: supervisor actor and task-actor for each task. I see two approaches: 
1. Creating one instance of every actor-task in memory. Scheduler will send run-messages to this actors.
2. Creating new instance of task for every run. Scheduler will create new instance (via third actor) for every run and send run-message. Actor-task will be terminated after execution

Which approach is better?
What are the advantages and disadvantages of these approaches?

Александр Семибратов

unread,
Feb 23, 2018, 1:01:35 AM2/23/18
to Akka User List

wapgui

unread,
Feb 23, 2018, 4:01:46 AM2/23/18
to Akka User List

Александр Семибратов

unread,
Feb 23, 2018, 12:51:57 PM2/23/18
to Akka User List
No. Akka scheduler suits my needs.

пятница, 23 февраля 2018 г., 13:01:46 UTC+4 пользователь wapgui написал:

Александр Семибратов

unread,
Feb 26, 2018, 1:01:15 AM2/26/18
to Akka User List
Share your opinions, please :-)

пятница, 23 февраля 2018 г., 21:51:57 UTC+4 пользователь Александр Семибратов написал:

wapgui

unread,
Mar 5, 2018, 7:26:33 AM3/5/18
to Akka User List
In build.sbt:

"com.enragedginger" %% "akka-quartz-scheduler" % akkaQuartz.version


In application.conf:

akka {
  quartz
{

    defaultTimezone
= "Europe/Berlin"
    schedules
{
     
ReloadDIY {
        description
="Reload content every day"
        expression
= "0 0/5 * * * ?"
     
}
   
}
 
}
}


In code:

val scheduler = QuartzSchedulerExtension(actorSystem)

scheduler
.schedule("Reload", actorSystem.actorOf(Props[ReloadActor]), "Reload")

That's all and works fine for me. It was used with akka 2.4, maybe now the akka internal scheduler is easier to use.
Reply all
Reply to author
Forward
0 new messages