Supervision

In essence, supervision in Akka Typed refers to the fact that all exceptions thrown from a behavior are caught and acted upon. An action can have one of three forms: resume, restart, and stop.

Let's see how supervision can be defined and which effect it has.

First, let's run our system as it is and observe its output:

... [INFO] Opening Bakery [INFO] Go shopping to Actor[akka://Typed-Bakery/user/Seller#1376187311] [INFO] Mixing Groceries(13,650,130,65) [ERROR] [akka://Typed-Bakery/user/Chef/Mixer_5] null   ch12.Mixer$MotorOverheatException   at ch12.Mixer$.$anonfun$mix$1(Mixer.scala:19)   at akka.actor.typed.internal.BehaviorImpl$ReceiveBehavior.receive(BehaviorImpl.scala:73)   ...   at java.lang.Thread.run(Thread.java:745)[INFO] PostStop ...

Get Learn Scala Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.