Want to know how to utilise concurrency primitives from FS2 and type classes from Cats Effect? Software Engineer, Viktor Lövgren at Scala in the City talks us through how to do this and reach a generic solution which abstracts over the effect type.
Have a watch and learn more about Akka Actors.
Replacing Akka Actors with Cats Effect and FS2
Akka actors can be used to solve many interesting challenges, but also come with a high cost: partial functions, mutability, special messaging syntax, supervision strategies, lifecycle management, actor systems, defining messaging protocols, and so on. In some cases, equivalent functionality can be achieved with concurrency primitives from FS2, with less overhead and improved type safety, immutability, and purity.
In this talk, Viktor will demonstrate how to implement the equivalent of an actor for managing authentication tokens. He will utilise concurrency primitives from FS2 and type classes from Cats Effect to reach a generic solution which abstracts over the effect type. Finally, he will refactor our solution into a reusable pattern.
View the coding from Viktor's talk below