Integrating Play app with Lagom application

Reading Time: 2 minutes

integrating Play app with Lagom

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:

Written by 

Rachel Jones is a Solutions Lead at Knoldus Inc. having more than 22 years of experience. Rachel likes to delve deeper into the field of AI(Artificial Intelligence) and deep learning. She loves challenges and motivating people, also loves to read novels by Dan Brown. Rachel has problem solving, management and leadership skills moreover, she is familiar with programming languages such as Java, Scala, C++ & Html.

3 thoughts on “Integrating Play app with Lagom application2 min read

Comments are closed.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading