In order to have a complete control on the components of my architecture, I'd like to deploy all the infrastructure components (Service Locator, Cassandra, Kafka) and services individually.
I'm able to run a service with a command as follows: mvn lagom:startServiceLocator lagom:startCassandra -pl hello-impl lagom:run
However, when I start these components individually (i.e. by mvn lagom:startServiceLocator
), the started component terminates automatically. In this case, I see the following logs but the locator is not available at http://localhost:9008
.
I'm on a local development environment with no proxy and using the default configurations.
How can I run those individually?
Java/Maven: If you want to run several Lagom microservices, you just need to do what you was doing:
mvn lagom:startServiceLocator lagom:startCassandra -pl hello-impl lagom:run
It will start locator, cassandra, if you need you can add kafka, after that, you just run in new cmd following command:
mvn -pl second-lagom-microservice-impl lagom:run
Now it will connect to running in first command cassandra and locator.
Lagom does not allow you to run cassandra or locator without running service.
Scala/Sbt:
For sbt the same approach, we need to run first microservice with all needed services:
sbt lagomServiceLocatorStart lagomCassandraStart lagomKafkaStart microservice-impl/run
Then just run another like:
**sbt another-microservice-impl/run**
Also, you can add an alias in build.sbt for your microservice to run it individually:
addCommandAlias(s"runMicrocervice1", ";lagomServiceLocatorStart;lagomCassandraStart;lagomKafkaStart;microservice1-impl/run")
And just run it as:
sbt runMicrocervice1