pykka icon indicating copy to clipboard operation
pykka copied to clipboard

Pykka actors auto scheduling

Open mffrench opened this issue 9 years ago • 3 comments

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

mffrench avatar Jun 30 '15 19:06 mffrench

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.

adamcik avatar Jun 30 '15 19:06 adamcik

OK thank you for this answer @adamcik ;)

mffrench avatar Jun 30 '15 22:06 mffrench

look at https://gist.github.com/fpt/f24d5a5e5fbe7549cabf

ghost avatar Aug 25 '16 15:08 ghost