I think I would make the sessions persistent actors, children of a SessionManager that is not a persistent actor. The SessionManager can always see if a child exists.
http://typesafe.com/activator/template/akka-persistence-event-sourcing http://pkaczor.blogspot.com/2014/04/reactive-ddd-with-akka.html On Wed, Oct 22, 2014 at 6:58 AM, Brice Figureau <[email protected]> wrote: > Hi, > > I'm converting an homegrown (cassandra based) persistence system to the > akka-persistence system. > > My system have clients connecting to it, creating a session in the > system. This session is implemented as SessionActor (which is now a > PersistentActor using the session id as persistenceId) and managed > through a central actor (SessionService also a PersistentActor). > > The SessionService maintains the list of active "sessions" and persists > events of type SessionAdded or SessionRemoved. After some times if the > client is idle, the session is removed from the SessionService. > > The workflow in the previous system when a client connects back (with a > session id) was to check if the session was known, first in the > SessionService internal list (live sessions), or if unknown in the > persistent storage in order to resume the given session (and if still > unknown would create a blank session). > > I can't port this part of the code to akka-persistence because there > doesn't seem to be a way to ask the journal if it ever persisted > something for a given persistenceId, so there's no way I can create a > SessionActor with the correct persistenceId that would recover the > session from the journal when a client connects back with a valid > sessionId. > > So I'm trying to look for workarounds and so far have found those > possibilities: > > * keep the list of knonw sessions in RAM, but this is very wasteful > especially if some clients never come back > > * keep the list of known sessions in the previous persistence system as > before (and still use the journal for the rest). I don't think this is > particularly elegant as is. > > * create a View on the SessionService journal that would store the > created sessions in the old persistent system (or anything else that > could later tell me a session existed) and at the same time answers > queries about session existence > > * I'm stupid and I forgot a very obvious idea > > If anything, I'd like any advice on the aforementioned solutions, > Many thanks, > -- > Brice Figureau > My Blog: http://www.masterzen.fr/ > > -- > >>>>>>>>>> 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 http://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 http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
