Re: [akka-user] How to tell if a given persistent actor ever persisted something?
Hi Brice, Sounds like you have found your way forward. A few curious thoughts. Are you using an Akka Cluster? Then Cluster Sharding http://doc.akka.io/docs/akka/2.3.6/contrib/index.html might help you here. It would take the role of your SessionService and manages the session actors for you within the cluster. It also has support for passivation (removing the session actors from memory when idle). One thing it can't do is to know if a session actor existed previously or not without sending a message to it. I'm not sure I understand when you will need that. When you send the initial message to one session actor the cluster sharding together with akka persistence will restore the old state or create a new actor with empty state. Cheers, Patrik On Wed, Oct 22, 2014 at 5:53 PM, Brice Figureau brice...@daysofwonder.com wrote: Hi, On Wed, 2014-10-22 at 08:46 -0700, Richard Rodseth wrote: If you have a use case that involves checking for session existence without sending a command to the session, you could publish a SessionCreated *domain* event (not an Akka persistence event) to the read side by publishing it to an Akka EventBus. The subscriber could then store some query-optimized info in Cassandra as you were doing before. In other words, using Akka Persistence with Cassandra journal doesn't preclude you from creating projections in Cassandra or even a relational store. That's roughly what I chose to do finally. Indeed akka-persistence doesn't cover all use case, and sometimes we need to add our own projections. When the Reactive Streams based read side is available there will be other options that let you build persistent views by aggregating multiple persistent actors. Hope this helps. I'm new to this too. Thanks, I'm new too and it's a bit hard to retrofit something written to a very different persistence paradigm :) -- 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout. -- Patrik Nordwall Typesafe http://typesafe.com/ - Reactive apps on the JVM Twitter: @patriknw -- 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
[akka-user] How to tell if a given persistent actor ever persisted something?
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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
Re: [akka-user] How to tell if a given persistent actor ever persisted something?
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 brice...@daysofwonder.com 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
Re: [akka-user] How to tell if a given persistent actor ever persisted something?
If you have a use case that involves checking for session existence without sending a command to the session, you could publish a SessionCreated *domain* event (not an Akka persistence event) to the read side by publishing it to an Akka EventBus. The subscriber could then store some query-optimized info in Cassandra as you were doing before. In other words, using Akka Persistence with Cassandra journal doesn't preclude you from creating projections in Cassandra or even a relational store. When the Reactive Streams based read side is available there will be other options that let you build persistent views by aggregating multiple persistent actors. Hope this helps. I'm new to this too. On Wed, Oct 22, 2014 at 8:14 AM, Richard Rodseth rrods...@gmail.com wrote: 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 brice...@daysofwonder.com 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
Re: [akka-user] How to tell if a given persistent actor ever persisted something?
Hi, On Wed, 2014-10-22 at 08:46 -0700, Richard Rodseth wrote: If you have a use case that involves checking for session existence without sending a command to the session, you could publish a SessionCreated *domain* event (not an Akka persistence event) to the read side by publishing it to an Akka EventBus. The subscriber could then store some query-optimized info in Cassandra as you were doing before. In other words, using Akka Persistence with Cassandra journal doesn't preclude you from creating projections in Cassandra or even a relational store. That's roughly what I chose to do finally. Indeed akka-persistence doesn't cover all use case, and sometimes we need to add our own projections. When the Reactive Streams based read side is available there will be other options that let you build persistent views by aggregating multiple persistent actors. Hope this helps. I'm new to this too. Thanks, I'm new too and it's a bit hard to retrofit something written to a very different persistence paradigm :) -- 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.