Hi,

The maxNrOfRetries parameter only applies to restarts: "the number of times
a child actor is allowed to be restarted, negative value means no limit, if
the limit is exceeded the child actor is stopped"

Please note though that the supervision block is similar to "receive" in
that you can safely access your actor's state, and "sender()" will point to
the actor being currently supervised. I.e. you can simply create a Map
storing ActorRef -> Int pairs (restart count for actor) to track resume
counts (you can store timestamps if you want to do a windowed approach).

-Endre


On Mon, Mar 21, 2016 at 10:08 PM, AS <[email protected]> wrote:

> instead of resume, if I use Restart ever thing works fine. But I don't
> want to use restart; which will initialize the actor.
>
>
> On Monday, March 21, 2016 at 11:15:19 AM UTC-5, AS wrote:
>>
>> Hi,
>>
>> I have setup supervisorStrategy as following in a supervisor ActorB, the
>> ActorC creates and ActorC.
>>
>> class ActorB extends Actor{
>>
>>   private var actorC: Option[ActorRef] = None
>>
>>
>>   override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 2,
>>      withinTimeRange = FiniteDuration(1, TimeUnit.MINUTES),loggingEnabled = 
>> true) {
>>      case _: TimeoutException => Resume
>>      case _: AskTimeoutException => Resume
>>   }
>>
>>
>>   override def preStart(): Unit = {
>>     actorC = Some(context.actorOf(ActorC.props, "actorC"))
>>     context.watch(actorB.get)
>>   }
>>
>> }
>>
>>
>> The ActorA is supervisor for ActorB, my understanding is that ActorB will 
>> Resume 2 time in 1 minute in case of TimeoutException or AskTimeoutException 
>> and afterwards it will escalate to ActorA.
>>
>>
>>
>> class ActorA extends Actor{
>>
>>   private var actorB: Option[ActorRef] = None
>>
>>
>>   override val supervisorStrategy = OneForOneStrategy{
>>      case _: TimeoutException => Stop
>>      case _: AskTimeoutException => Stop
>>   }
>>
>>
>>   override def preStart(): Unit = {
>>      actorC = Some(context.actorOf(ActorB.props, "actorC"))
>>      context.watch(actorB.get)
>>   }
>>
>>
>> def receive: Receive = {
>>
>>   case t: Terminated => {
>>     context.stop(self)
>>     context.system.shutdown()
>>
>>   }
>>
>>
>> }
>>
>>
>> This means ActorA should shutdown system after 2 times resume strategy in 1 
>> minute, but I don't see it is happening, not sure where I a going wrong.
>>
>>
>> Thanks
>>
>> Arun
>>
>>
>> --
> >>>>>>>>>> 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 https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Akka Team
Typesafe - Reactive apps on the JVM
Blog: letitcrash.com
Twitter: @akkateam

-- 
>>>>>>>>>>      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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to