Hi, I looked at your code. A few comments:
- What is the purpose of using ask in the Retry actor? The timeout failure, and akka.actor.Status.Failure replies will be sent (pipeTo) to the original sender anyway. - Does it work? Is the message in preRestart defined when the child fails? A new Retry actor is created for each message anyway, so you could pass the message in the constructor. - You need to stop the Retry actor. watch the child and stop the Retry actor when it receives Terminated for the child. Cheers, Patrik On Mon, Oct 20, 2014 at 3:16 PM, "Ionuț G. Stan" <[email protected]> wrote: > Hey everyone, > > I've recently needed a retry mechanism for failed messages and after a bit > of searching I've noticed that the recommended way would be to spawn a new > child actor for each message that needs to be retried, restart it through > supervision and have the child actor reschedule, in preRestart, the failed > message to itself after a configurable delay. > > Because I'm very new to Akka (three weeks of real-world usage), I would > like some feedback on this piece of code: > > https://gist.github.com/igstan/43ab1ad361b74844d7b8 > > My comfort area is FP code, where everything flows in through function > parameters and out through return values. When I'm in actor-land, though, > everything is so much harder for my brain to grasp. I feel like there are a > lot of moving parts with no order I can rely on or type system crutches to > lean on. > > That's why I'm actually very certain that the code I've written doesn't > treat all possible cases (DeathWatch maybe?), but because I don't have a > systematic way to think about an actor's interaction with its outside world > I need help. > > Any feedback and pointers will be helpful. > > Thanks! > > -- > Ionuț G. Stan | http://igstan.ro > > -- > >> 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. > -- Patrik Nordwall Typesafe <http://typesafe.com/> - Reactive apps on the JVM Twitter: @patriknw -- >>>>>>>>>> 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.
