What is Lagom?
Simply put, it is a microservices tool.
Lagom is a microservices framework that guides developers in moving from monolithic to a scalable, resilient microservice based systems. It is a platform delivering you not only the microservice framework but also a whole tool set for developing applications along with creating, managing and monitoring your services.
According to Lightbend the focus should not be on how small the services are, but instead they should be just the right size, “Lagom” size services.
Most microservices frameworks focus on making it easy to build individual microservices. Lagom allows developers to run a whole system of microservices from a single command.
Before you begin creating your microservices, you need to make some selections:
Choosing your development tool:
Lagom exposes two APIs, Java and Scala, and provides a framework and development environment as a set of libraries and build tool plugins. You can choose as per your requirement.
Choosing your build tool:
Maven and sbt both provide dependency management to download the Lagom libraries and plugins for you.
Structure of a microservice:
By convention every lagom microservice is divided into 2 parts: API and implementation. API is the formal contract. It tells the other developers and teams what the given service can do for them and how to interact with it. Implementation is where the code lives. It’s strongly decoupled from API so you can evolve it separately, as long as the contract holds.
Lagom microservice = api + impl
Here, we are going to hit the Lagom microservices via the Play controllers.
For this, we have 3 microservices, out of which two of them are lagom services, one produces the data(producer-api and producer-impl) and the other consumes the data(consumer-api and consumer-impl) and the third one is the play service(web-gateway) which internally calls our lagom services.
Here, all the calling goes into the actions defined in the HelloController.scala
The runnable code can be found here: https://github.com/knoldus/lagom-play-spike
The pre-requisites and steps to run the application are given here https://github.com/knoldus/lagom-play-spike/blob/master/README.md
In this blog I’ve only made an effort for Integrating Play app with Lagom service. For a deeper understanding refer the below link: https://www.lagomframework.com/
References:
- http://blog.scalac.io/2016/07/14/lagom-scala.html#lagom-platform
- https://ordina-jworks.github.io/microservices/2016/04/22/Lagom-First-Impressions-and-Initial-Comparison-to-Spring-Cloud.html
- https://www.lagomframework.com/
Reblogged this on swatirao and commented:
Lagom + Play : The best combination indeed
Reblogged this on Foobar and commented:
Playing with play and Lagom !