Well, for the integration points, assuming you need a response, uaing ask is a very good approach. I think the Play framework takes tgis approach. On Oct 20, 2015 10:40 PM, "Rich Henry" <[email protected]> wrote:
> This is definitely another option, but the object starting my actor is not > an actor. > > I could possibly use inbox() to achieve a similar effect. I will think > about it. Thank you. > > On Tuesday, October 20, 2015 at 3:23:07 AM UTC-4, Adam wrote: >> >> Hi, >> >> In my system I have an initialization sequence that must take place at a >> certain order. >> Basically I don't want to open my system for incoming requests, before >> all services are properly started. >> So what I needed is sort of similar to what you describe here. >> >> I've implemented it without ask. >> Whenever a "service" actor is started it starts initialization in >> preStart and ultimately sends a ServiceStarted back to it's parent. >> As I sometimes have a hierarchy of such services, some of them do not >> immediately reply from preStart as they themselves wait for of their >> dependencies to reply with ServiceStarted. >> During this sequence I have a receive timeout set in the waiting Actors >> and I remove it once they are fully initialized. >> >> In my case this all takes place within the same JVM, so I didn't bother >> with Acks, so overall it's not too complex. >> >> I hope this helps. >> >> >> >> On Monday, October 19, 2015 at 6:16:51 PM UTC+3, Rich Henry wrote: >>> >>> All the other components are thread-safe. >>> >>> I just need an order of operations including the actorOf call, so coming >>> full circle, my original plan was to use some kind of initialization >>> message with the ask pattern to sync it up. >>> >>> I was trying to figure out if this is the best i can do. >>> >>> >>> >>> >>> On Monday, October 19, 2015 at 11:00:58 AM UTC-4, √ wrote: >>>> >>>> Hi Rich, >>>> >>>> On Mon, Oct 19, 2015 at 4:50 PM, Rich Henry <[email protected]> wrote: >>>> >>>>> I would if it told me when that chain of events starts and stops >>>>> relative to the actorOf call itself. >>>>> >>>> >>>> actorOf is asynchronous so that's completely separate from the >>>> lifecycle. >>>> >>>> >>>>> >>>>> My actor needs to register with another non-actor subsystem before i >>>>> interact with it, so If i write code like... >>>>> >>>>> val subsys = new SubSys() >>>>> val a = system.actorOf(Props(classOf[MyActor], subsys)) // >>>>> constructor registers with subsys >>>>> subsys.go() >>>>> >>>>> There is a race condition as the constructor for my actor doesn't get >>>>> called before .go(). >>>>> >>>> >>>> Is `subsys` threadsafe? Can your MyActor send a message somewhere to >>>> indicate that it has registered with subsys? >>>> >>>> >>>>> >>>>> >>>>> On Monday, October 19, 2015 at 10:24:32 AM UTC-4, √ wrote: >>>>> >>>>>> >>>>>> >>>>>> On Mon, Oct 19, 2015 at 4:11 PM, Rich Henry <[email protected]> >>>>>> wrote: >>>>>> >>>>>>> I guess that's the why of question 2. Im not clear when the >>>>>>> different lifecycle phases, like preStart, occur. >>>>>>> >>>>>>> I would assume preStart occurs after object construction, and is >>>>>>> asynchronous to the system call used to create the actor, is that not >>>>>>> so? >>>>>>> >>>>>>> >>>>>> Does the documentation help? >>>>>> >>>>>> http://doc.akka.io/docs/akka/2.4.0/scala/actors.html#Actor_Lifecycle >>>>>> >>>>>> >>>>>> >>>>>>> On Monday, October 19, 2015 at 9:40:44 AM UTC-4, √ wrote: >>>>>>>> >>>>>>>> Hi Rich, >>>>>>>> >>>>>>>> and why can't it be executed in preStart()? >>>>>>>> >>>>>>>> On Mon, Oct 19, 2015 at 3:20 PM, Rich Henry <[email protected]> >>>>>>>> wrote: >>>>>>>> >>>>>>>>> I had seen a previous post that didn't really seem to come to any >>>>>>>>> definite conclusion about this subject. >>>>>>>>> >>>>>>>>> I have some synchronous behavior I need to accomplish during my >>>>>>>>> actor's construction, but the constructor is called asynchronously. >>>>>>>>> >>>>>>>>> 1) Is the accepted way to do this to use an initialization message >>>>>>>>> of some kind with the ask pattern? >>>>>>>>> >>>>>>>>> 2) Is there any documentation beyond the short section in the >>>>>>>>> manual that talks about actor lifecycle specifics? >>>>>>>>> >>>>>>>>> -- >>>>>>>>> >>>>>>>>>> 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. >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> Cheers, >>>>>>>> √ >>>>>>>> >>>>>>> -- >>>>>>> >>>>>>>>>> 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. >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Cheers, >>>>>> √ >>>>>> >>>>> -- >>>>> >>>>>>>>>> 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. >>>>> >>>> >>>> >>>> >>>> -- >>>> Cheers, >>>> √ >>>> >>> -- > >>>>>>>>>> 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 a topic in the > Google Groups "Akka User List" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/akka-user/69j5j77t87E/unsubscribe. > To unsubscribe from this group and all its topics, 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.
