Lagom design philosophy

§Lagom design philosophy

Consider some of the basic requirements of a Reactive Microservice as identified by Jonas Bonér (quotes extracted from Reactive Microservices Architecture: Design Principles for Distributed Systems):

  • Isolation is a prerequisite for resilience and elasticity and requires asynchronous communication between service boundaries …”
  • “An autonomous service can only promise its own behaviour by publishing its protocol/API.” and “For a service to become location transparent, it needs to be addressable.”
  • “What is needed is that each Microservice take sole responsibility for their own state and the persistence thereof.”

The following Lagom characteristics promote these best practices:

  • Lagom is asynchronous by default — its APIs make inter-service communication via streaming a first-class concept. All Lagom APIs use the asynchronous IO capabilities of Akka Stream for asynchronous streaming; the Java API uses JDK8 CompletionStage for asynchronous computation; the Scala API uses Futures.

  • Lagom favors distributed persistent patterns in contrast with traditional centralized databases. We encourage — but do not require — an event-sourced architecture for data persistence. The default pattern for persisting entities takes advantage of Event Sourcing (ES) with Command Query Responsibility Segregation (CQRS). Managing data persistence explains at a high level what event sourcing is and why it is valuable. Persistent Entity introduces Lagom’s implementation of event sourcing.

  • Lagom provides an implementation of a service registry and a service gateway for development purposes along with the internal plumbing for managing client and server-side service discovery. Registering and discovering services introduces these concepts.

Found an error in this documentation? The source code for this page can be found here. Please feel free to edit and contribute a pull request.