1

Java API here. Brand new to Akka, and trying to understand how its Fault Tolerance model applies to actor messaging that falls outside the parent/child or supervisor/supervisee pattern.

If my understanding of Akka is correct, one actor can communicate (via ask(...) and tell(...)) with another actor even if its not that other actor's supervisor. So to me, this means you can have "peer actors" communicating with each other. For instance, perhaps a FizzRouter is an actor that is the supervisor of, say, 20 FizzActor instances. But each of those FizzActor instances may communicate (tell/ask) with lots of other types of actors, that are merely peers and not their actual supervisor.

So SupervisorStrategies are wonderful for mapping Throwables to Directives (stop, restart, resume, escalate), when a (supervised) child is failing. But how do we handle failure when a tell or ask to one of our so-called "peer" actors throws exceptions? What would this code look like (again, Java API here)?

smeeb
  • 27,777
  • 57
  • 250
  • 447
  • Why the downvote sans explanation? This isn't a dupe, it shows knowledge over the domain (and hence research), and is an [SSCCE](http://sscce.org/) (at least as far as understandability and answer-ability goes). I smell a hit and run! – smeeb Jun 23 '15 at 01:20
  • 1
    smeeb have you looked into watch? I am also myself new to akka, but that could possibly be an option – scarpacci Jun 23 '15 at 01:36
  • Thanks @scarpacci (+1) - yes I am familiar with `watch` and `unwatch`, but those only tell you when peers fail asynchronously. They won't help you handle when a `tell()` or `ask()` fail, unless I'm missing something. Ideas? Thanks again! – smeeb Jun 23 '15 at 01:48
  • Ahhh I gotcha. Not sure about tell, but with ask you then call myAsk.onComplete { Success(value) => do something Failure(ex) => do something}. Not sure if this s on the right track of what you are asking or not. I will have to look at tell a bit more. – scarpacci Jun 23 '15 at 02:20
  • 1
    `tell()` is `fire-and-forget`, so the actor processing this message should handle the error.. In case you want a response you should be using `ask()` and handle the failure. – Johny T Koshy Jun 23 '15 at 06:07

0 Answers0