akkalagom

Difference between Lagom and Akka Projection


Reading on Akka Projection project I can't get rid of the feeling that it serves the same purpose as Lagom (framework for building actor based reactive microservices).

Other similarities:

Some differences:

All of this not to mention Akka Serverless which is a PAAS only that takes care of the following logic:

...but relies on the same programming and design model.

Maybe someone more knowledgeable/with more insights could explain what is the relationship if any? Is one product being gradually abandoned in favour of the other (in which case it would be nice to let the community know)? If yes, is this due to the shift of Lightbend's business model? Knowing this is important before taking technical decisions about using either of the two products.


Solution

  • Lagom is an opinionated framework on top of Akka, especially around Cluster Sharding and Persistence (as well as a means to define HTTP interactions similarly to Play, and a defined approach to dependency injection). It included, in its ReadSideProcessor an opinionated way to project an event stream from persistence for CQRS.

    Many recent advances in Akka are partially based on incorporating some learning from Lagom around being more opinionated. Projection brings something similar though more general (as it can project, e.g. events from Kafka) to the ReadSideProcessor to Akka; it may be noteworthy that Projection is largely the work of one of the core maintainers of Lagom.

    I wouldn't really categorize Akka Platform as a PaaS, but more of an alternative pricing/consumption model for a subset of the "Lightbend Subscription" (Akka Platform is usage-based without as much of a consulting-type arrangement; the Subscription's pricing might fairly be described as "if you have to ask how much it costs, you probably can't afford it", but it does include some level of consulting engagement from a group that really knows the Akka/Lagom/Play stack). Otherwise the Akka Platform is Akka.

    Akka Serverless's PaaS is Akka under the hood, but the Akka-ness is hidden (for better or for worse) behind a gRPC API. As in Lagom, you're defining domain entities' behavior and a framework layer is manifesting that as an Akka actor; Akka Serverless more strictly separates that manifestation than Lagom (it's quite possible and sometimes even useful in Lagom to strip away the Lagom veneer to expose more Akka), but that in turn allows the behavior to be defined in any language that can speak gRPC.

    I can't speculate on what the future holds. Akka itself is pure open source (and not a small portion of its contributors aren't employed by Lightbend): so it's somewhat immune from whatever happens with Lightbend (the scope of the commercial add-ons has also decreased over the years, most notably with the multi-region persistence and the split-brain resolver being open-sourced). There are use cases for Akka that will probably never effectively be useful in Akka Serverless. As for Lagom, it's possible that it's achieved its goals and will be considered mature (joining various other microservice-first frameworks).

    I personally would tend to use vanilla Akka: I'd consider the recommended Typed APIs (especially in Scala) to provide "just the right amount" of opinionation, albeit less than Lagom. Coming from a Scala background, the lack of DI is also appreciated. If you decide you want the commercial add-ons and are running in a public cloud on Kubernetes, then the Akka Platform is probably worth getting; for other deployments, the Subscription might be worth it.