Thanks for answering Anders, your answers were very helpful.

for #1 (starting in a known state). I was more asking how do I start
with a 'fresh/clean' journal with no history. I can manually remove
the files, but I was hoping there was something in the test-kit I
could do which will achieve this so I can do the tests in my IDE.



On Mon, Jan 5, 2015 at 6:55 AM, Anders Båtstrand <ander...@gmail.com> wrote:
> I have only been using Akka Persistence for a few months, but this is my
> suggestions:
>
> 1. I always start empty, but that is possibly not what you want. Maybe a
> file based storage, and you copy the files in place right before you start
> the Akka system?
>
> 2. I have solved the same problem by letting the parent actor be responsible
> for killing the children. That is: The child receives an event that it
> calculates should result in it's own destruction, and it then calls the
> parent, which then kills it (and updates a map over actors). In my case the
> parent is also delegating messages to the child, so this way I am sure not
> to send messages to any actor that is on the way down (that is, before the
> parent received the Terminated-message).
>
> 3. I am not sure i understood the question. I have CreateChild and KillChild
> events persistent from the parent actor. During recovery, it makes a map
> over actors it should create or not, and only creates then
> onRecoveryComplete. That way I do not create actors I would immediatly kill.
>
> Hope this was helpful!
>
> Best regards,
>
> Anders Båtstrand
>
> kl. 19:20:30 UTC+1 fredag 2. januar 2015 skrev Ian Holsman følgende:
>>
>> Hi.
>>
>> I'm building a 'toy' game that makes uses of akka-persistence, in order to
>> learn it.
>>
>> in a nutshell the game is 1000's of people/bots create villages, they act
>> independently of each other, and generally pass messages to each other to
>> chat/fight and all that good stuff.
>>
>> Where I am having problems are:
>>
>> 1. how do I initialize the persistence system at the start of testing so I
>> am in a 'known state' when I start.
>>
>> 2. how I assign IDs (persistanceId)  to actors.
>> Ideally I would use a map reference for while the villages exist, and be
>> able to re-use them if a new village is created. but the problem is it finds
>> the old village, and replays all the events (including the death event which
>> kills it).
>> I don't mind re-using a old actor, but i'd like to stop it (ie poisonpill)
>> when it isn't active.
>>
>> It seems like they need to be unique for the life of the system, and to do
>> so I would need a counter in place or GUIDs. but then I would need to keep
>> track of the Map reference/GUID mapping meaning my code would need to first
>> talk to the mapping holder, and then to the village itself (2 messages, 1
>> sync) which seems like non-ideal. (as opposed to context.actorselection("XYZ
>> map-reference") ! message which I guess is still 2 messages under the
>> covers, 1 sync too)
>>
>> 3. the recovery log only seems to 'start' when I bring up the actor.
>> Is there a way to know which actors are currently 'active' and just let
>> Akka start them all up, instead of me keeping a list/map of 'active'
>> villages, and manually restarting them.
>>
>>
>>
>> Thanks ..
>>
>> Ian.
>
> --
>>>>>>>>>>> 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.



-- 
Ian Holsman
i...@holsman.com.au
PH: + 61-3-9028 8133 / +1-(425) 998-7083

-- 
>>>>>>>>>>      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