Summary

Akka Typed allows you to implement an actor system in a type-safe way. It represents actor logic as a well-typed behavior with the types of both input and output channels determined at compile time. Behaviors can be combined together, allowing for a higher degree of code reuse.

Typed actors are not only supposed to receive and send messages but are also required to explicitly define a new behavior after processing every message. Interactions with other actors are limited to creating, stopping, looking up, and watching children, and getting typed references to explicitly registered services.

Actor context provides useful functionality, such as timers and stashing.

Typed supervision is defined directly on behavior, and the failure propagation to the parent actor must be implemented explicitly if needed. The Akka team took a holistic approach by promoting an actor's life cycle hooks, from methods to events.

Actors in typed Akka are basically just functions. Because of this, testing is not limited to asynchronous communication as it was before. This can be done synchronously, thus allowing for deterministic and stable test code that executes quickly.

Akka Typed offers a set of useful extensions like cluster, cluster singleton, persistence, and distributed data. We touched briefly upon how the cluster module allows us to utilize the existing code in a distributed scenario by solely changing the configuration of the system. Please refer to the Akka Typed official documentation online (https://doc.akka.io/docs/akka/current/typed/index.html)  to explore further capabilities provided by the typed actor's toolkit.

In the next chapter, we're going to implement the bakery once again, this time using yet another Akka library—Akka Streams.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.224.226