Hi, a good idea is to use postStop to clean up everything that was created in preStart. For example scheduled tasks or PersistentView actors, etc.
On Wed, Nov 5, 2014 at 9:19 AM, Prakhyat Mallikarjun <[email protected]> wrote: > Hi Björn, > > Thanks for your inputs. > > Sorry its not "postStartup" method, we are currently creating view > instance from preStart() method of PersisentActor. > > I understand your inputs. > > The problem I could think when instantiating view from pre start of > persistent actor is as explained below, > 1. The persistent actor is created using sharding. We are using single > writer to handle our domain. > 2. The persistent actors are sharded by domain's id. > 3. The persistent actor has "persistenceId" as id of domain object. > 4. We are creating view from preStart of persistent actor. > 5. While starting view, persistent id of persistence actor is passed as > constructor input. > > When the persistent actor is created for first time, creating view from > preStart looks good place and it works. > > But consider a case, persistent actor goes down, and view still running. > When the persistent actor comes up, pre start will be invoked again, and as > per the code view will be instantiated again. We don't have mechanism to > check view is up and running, if such mechanism would have exist, we could > have used to validate whether view can be created again or not. > > The view and persistence actor are tightly coupled together. How to get > rid of this tight coupling? View for persistent actor should run > independently? How to create views, when persistent actor is sharded?How to > separate persistent actor from view? > > Is there a possibility to shard views? If yes how to created them from > perspective of single writer approach? > > -Prakhyat M M > > On Wednesday, 5 November 2014 03:24:17 UTC+5:30, Björn Antonsson wrote: >> >> Hi Prakhyat, >> >> Where to start your persistent view should be based on what you try to >> achieve with it, and how tightly coupled its life cycle should be to the >> persistent actor. You might want to separate them for scalability and >> performance reasons (the views and actors can have very different >> peformance characteristics). >> >> When you say postStartup method, which method do you mean exactly? I >> can't find any postStartup method in akka 2.3.6. >> >> B/ >> >> On 31 October 2014 at 13:58:33, Prakhyat Mallikarjun ([email protected]) >> wrote: >> >> Team, >> >> We are currently instantiating Persistence View's from postStartup method >> of persistent actor. Is this the right place? >> >> What are the recommendations for instantiating Persistence View's? and >> from where? >> >> -Prakhyat M M >> -- >> >>>>>>>>>> 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. >> >> >> -- >> Björn Antonsson >> Typesafe <http://typesafe.com/> – Reactive Apps on the JVM >> twitter: @bantonsson <http://twitter.com/#!/bantonsson> >> >> -- > >>>>>>>>>> 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. > -- Martynas Mickevičius Typesafe <http://typesafe.com/> – Reactive <http://www.reactivemanifesto.org/> Apps on the JVM -- >>>>>>>>>> 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.
