How it works
In this recipe, we explored how Lagom integrates with Akka. In this particular example, we created a simple calculator service where the actual calculations occur in an actor. The way we can use the actor system in our CalculatorServiceImpl class is by adding a parameter (system: ActorSystem). Lagom will understand that it needs to inject the instance of the actor system. Once you have the actor system reference, you can do almost anything you need with Akka, as we have seen in all the chapters in this book. In this case, we create a new actor and ask for either Sum or Multiply. Therefore, turning already developed Akka applications into microservices can be a matter of creating a new service in front of each actor (or set of ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access