Rafał, thank you for the fast reply!
I had though about using a separate 'scheduler' actor but could not quite get my head around it. I want user inactivity to trigger an action - wouldn't I have to send an an event to the scheduler actor whenever any user interacted with the system to 'restart' that user's timeout? And wouldn't the scheduler actor's state become prohibitively large, containing a 'last active' timestamp for every user in the system? The core of the problem for me is that only a small fraction of user interactions will be the 'last interaction before a timeout', but the application has no way of knowing in advance which they are. Does that make sense? Any advice is much appreciated! - Arno Am 08.03.2017 um 14:07 schrieb Rafał Krzewski: > Hi Arno, > > I think you need a separate persistent actor that will keep track of > long-term scheduled events. It will be active at all times and keep an > agenda of future notifications in it's persistent storage. It will use > ActorSystem Scheduler to wake itself up when it's time to send out next > (batch of) notification(s). A message sent to a shared User entity will > activate the target if necessary. > I think it will be reasonable from resource management point of view, > and also safe against system restarts. > > Cheers, > Rafał > > W dniu środa, 8 marca 2017 06:35:11 UTC+1 użytkownik Arno Haase napisał: > > I am working on a social media kind of system, and we have users > represented as sharded persistent entities. Now we want to react to > users' inactivity, e.g. sending out 'come back' emails to users who > were > inactive for a week. > > Any suggestions for how to implement that? Scheduling (and mostly > cancelling) messages in every user's actor seems both wasteful and > unreliable, at least if we remove long unused entities from memory. > > All ideas are welcome! > > - Arno > > -- >>>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>>> Check the FAQ: > http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user > --- > You received this message because you are subscribed to the Google > Groups "Akka User List" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at https://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
