[akka-user] Re: actor lookup and restart

2016-07-19 Thread Rob Crawford
I use constructor injection or use the Spring Extension to let Spring inject ActorRefs. Another way is to start with the ActorSelection, then send an Identify message -- the other actor will automatically reply with an ActorIdentity message that contains an ActorRef. On Tuesday, July 19,

Re: [akka-user] Re: actor lookup and restart

2016-07-19 Thread Konrad Malawski
Don't do static global state, it's a bad code smell in general. -- Konrad `ktoso` Malawski Akka @ Lightbend On 19 July 2016 at 10:05:11, James (breath...@gmail.com) wrote: Thank you Rob, Another way is to pass the actorRef to a static object, which can

[akka-user] Re: actor lookup and restart

2016-07-19 Thread James
Thank you Rob, Another way is to pass the actorRef to a static object, which can be referenced by other instances later. I am wondering which way is better: pass the actoreRef to a class instance or assign the actoreRef to a static attribute in an object. Best, James On Tuesday, July 19,

[akka-user] Re: actor lookup and restart

2016-07-18 Thread Rob Crawford
If the Actor gets restarted, the ActorRef will still be valid. That's one of the reasons for ActorRef. On Monday, July 18, 2016 at 3:16:13 PM UTC-4, James wrote: > > Hi, > > The document saying > > "It is always preferable to communicate with other Actors using their > ActorRef instead of