Persistence API

Chef in our scenario takes some time to complete the mix process. Because of this, we would like to store the work in progress so that, in case the service is restarted, it does not get lost and the process just continues from where it was interrupted after recovery.

We will use persistence facilities provided by the framework in order to implement this. The recommended way to persist data in Lagom is by utilizing an event sourcing approach, which we already used to implement an example project in Chapter 14, Project 1 - Building Microservices with Scala. Lagom automates data schema creation with Cassandra and also provides a Cassandra instance for development purposes. Therefore, we can start directly with the definition ...

Get Learn Scala Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.