What if the actor injected had an exception and restarted? 

Will it have a new ActorRef?If so, then the previously ActorRef wont work?


On Tuesday, November 25, 2014 11:39:48 PM UTC+8, Konrad Malawski wrote:
>
> That's how I'd do it as well.
> With he caveat that variable names should be lower case in Scala :-)
>
> If you'd need moer advanced things you can look at the cake pattern 
> (that's pure scala, but sometimes gets a bit complicated).
>
> Hope this helps! 
>
> On Tue, Nov 25, 2014 at 3:23 PM, Andrew James Ramirez <
> [email protected] <javascript:>> wrote:
>
>> Hi,
>>
>> What is the best way to do this? Currently what I'm doing is 
>>
>> class MainActor(Dependency1:ActorRef, Dependency2:ActorRef) = {
>>  def receive ={
>>      case TestMessage =>
>>         Dependency1 ! "Test"
>>  }
>>
>> }
>>
>> object MainActor{
>>   def props(Dependency1:ActorRef, Dependency2:ActorRef) = Props(classOf[
>> MainActor], Dependency1, Dependency2)
>> }
>>
>>
>>
>>
>> val dependency1 =  system.actorOf(Dependency1.props())
>> val dependency2 =  system.actorOf(Dependency2.props())
>>
>> val mainActor =  system.actorOf(MainActor.props(dependency1, dependency2
>> ))
>>
>> mainActor ! "TestMessage"
>>
>>
>>
>>  -- 
>> >>>>>>>>>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Cheers,
> Konrad 'ktoso' Malawski
> hAkker @ Typesafe
>  

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

Reply via email to