3453b7a18b | ||
---|---|---|
.. | ||
greeting-api/src/main | ||
greeting-impl | ||
project | ||
weather-api/src/main | ||
weather-impl | ||
.gitignore | ||
README.md | ||
build.sbt |
README.md
Lagom
This module contains articles about the Lagom framework.
Relevant articles
Steps to setup from scratch
-
Create sbt build file "build.sbt"
-
Create plugins file project/plugins.sbt
-
Create build properties file project/build.properties
-
Run sbt command from project root to generate project directories, generated projects at target/lagom-dynamic-projects Service Locator project: lagom-internal-meta-project-service-locator cassandra project: lagom-internal-meta-project-cassandra
-
Create folders in all projects to follow maven like directory structure layout for project source code: src/main/java and src/main/java/resources and test folders.
-
Weather microservice a) WeatherService Interface with method: weatherStatsForToday() b) WeatherServiceImpl to return weatherstats from a random list of weather stats
-
Greeting Microservice GreetingService Interface: handleGreetFrom(String user)
a) Reply back to user with greeting message("Hello") along with weather stats fetched from weather microservice b) Update the greeting message("Hello Again") for an existing user.
-
GreetingEntity: PersistentEntity<GreetingCommand, GreetingEvent, GreetingState> a) handles ReceivedGreetingCommand b) Stores ReceivedGreetingEvent events to cassandra c) Processes ReceivedGreetingEvent to update GreetingState("Hello" to "Hello Again") if required.
-
Register modules with lagom using application.conf files.
-
Run project: sbt lagom:runAll
Sample Run:
$ curl http://localhost:9000/api/greeting/Nikhil;
Hello Nikhil! Today's weather stats: Going to be very humid, Take Water
$ curl http://localhost:9000/api/greeting/Nikhil;
Hello Again Nikhil! Today's weather stats: Going to Rain, Take Umbrella