pykka
pykka copied to clipboard
Pykka actors auto scheduling
Hello pykka contributors,
is there any equivalent and easy way to implement some message scheduling like we have in akka lib ;
InjectorAkkaSystemActivator.getSystem().scheduler().schedule(Duration.Zero(),
Duration.create(millisecondPeriod, TimeUnit.MILLISECONDS),
actor,
message,
InjectorAkkaSystemActivator.getSystem().dispatcher(),
null));
Or do we need to implement this kind of scheduler ourself ? Do you have some best practices on that topic ?
Cheers,
Mathilde
Personally I'm not that familiar with Akka, but if I understand the sample code correctly you want to arrange for the message to get sent in x milliseconds. As far as I know Pykka doesn't have any good way of adding this currently.
I've been looking for something similar myself. And the workaround I looked at usually ends up being to use an event loop we already have running in the project and have it send messages. My suspicion, if I remember jodal's plans more or less correctly is that adding things like this in alignment with akka features will probably be in scope for one of the next pykka major releases.
OK thank you for this answer @adamcik ;)
look at https://gist.github.com/fpt/f24d5a5e5fbe7549cabf