Lagom reached end of life on July 1, 2024
This project will no longer receive security or functional patches.
If you use Lagom and need assistance, please contact the team at Akka, formerly Lightbend. Akka and its partner ecosystem can help you plan and execute the optimal migration path for your applications.
Have a question about Lagom? We’ve sorted out a sample of frequently asked questions and provided answers below. If your question is not covered here, try these resources:
Does Lagom require me to use Cassandra for persistence?
No, Lagom supports using either Cassandra, Couchbase or relational databases, including MySQL, PostgreSQL, Oracle, SQL Server and H2. The Lagom development environment provides and uses Cassandra by default because it offers great scalability and replication features. See more in the Java documentation or the Scala documentation.
Does Lagom require the use of a message broker such as Kafka?
No, but it is very useful for common communication scenarios. Lagom’s Message Broker API integrates Persistent Entities with message brokers such as Apache Kafka to provide publish-subscribe messaging between services with at-least-once delivery guarantees. This enables you to design decoupled and highly-resilient systems of microservices.
If you prefer not to run a message broker, however, the Message Broker API is entirely optional. You can write Lagom services that communicate with each other directly by using HTTP requests or by streaming data over a WebSocket.
See more in the Java documentation or the Scala documentation, including how to disable it in your Java or Scala projects.
Does Lagom support message brokers other than Kafka?
The Message Broker API was designed to make it possible to integrate with alternative message broker services. Currently, Lagom only includes support for Kafka, but advanced users can write their own implementations of the Message Broker API. Future versions of Lagom might include new, officially-supported implementations.
If you are interested in official support for new message brokers, please review the open feature requests for Message Broker API on GitHub. You can vote or comment on existing issues, or create new ones.
Does Lagom require using event sourcing and CQRS?
You can handle data persistence any way you like in a Lagom service, but we strongly encourage event sourcing and CQRS, and the Lagom Persistent Entity API is designed to support these patterns. For services where you do not wish to use event sourcing and CQRS, you use any data access client you choose, as long as you are careful to avoid I/O blocking the primary thread pool, which would cause performance problems and timeout errors.
Lagom provides utilities that can be used to issue non-blocking execution of database statements: CassandraSession
(Java/Scala), JdbcSession
(Java/Scala), and JpaSession
(Java-only). Scala users might be interested in using Slick for relational database access. The Alpakka project offers Akka Streams connectors for a variety of data stores that can be conveniently used with both the Java and Scala flavors of Lagom. Many non-relational databases offer their own non-blocking, asynchronous clients, either officially or through third parties.
See more in the Lagom documentation on Managing data persistence and Advantages of Event Sourcing.
Can I use serialization methods other than JSON?
Yes, Lagom supports extensible serialization, both for messages transmitted between different services and for internal messages and persistent data used within a service. JSON is supported by default, as it is simple and well understood. Services that require higher performance or more compact data can use alternatives such as Protocol Buffers, Apache Avro, Kryo, or any other serializer that you choose.
See more in the Lagom documentation on Message Serializers (Java/Scala) and Persistent Entity Serialization (Java/Scala).