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.

Reply via email to