Ans Trakhtman
02/27/2024, 1:52 PMimport akka.actor.*
import com.typesafe.config.Config
import kotlin.time.Duration.Companion.seconds
class JobsScheduler {
fun run(config: Config) {
val system = ActorSystem.create("jobsScheduler", config)
val job = system.actorOf(Job.props(), "job1")
system.scheduler.scheduleOnce(5.seconds, job, Job.Message("foo")); // this needs some ExecutorContext, which I can't figure out what it is.
}
}
I would greatly appreciate any help to make this dummy example run. Can’t figure out what’s wrong 🤦Ans Trakhtman
02/27/2024, 2:11 PMAns Trakhtman
02/27/2024, 2:25 PMclass JobsScheduler {
fun run(config: Config) {
val system = ActorSystem.create("jobsScheduler", config)
val job = system.actorOf(Props.create(Job::class.java), "job")
val anonymousFunction = fun() {
job.tell("hello", ActorRef.noSender());
}
system.scheduler().scheduleWithFixedDelay(Duration.ofSeconds(0), Duration.ofSeconds(5), anonymousFunction, system.dispatcher())
}
}
Ans Trakhtman
02/27/2024, 2:25 PMTies
02/27/2024, 3:21 PM