Microservice Configuration in play 2 framework
Asked Answered
B

1

0

I have divided my application into different projects in PLay 2. But I just realised I do not know how to run multiple play application in the same server.

Anyone knows how to do it?

Let us suppose it is not possible,Therefore, I will just deploy multiple play application in the same root project (The microservice will act as a plugin). Do you think this will defeat microservice architecture?. I will make each module act independently.

Breakout answered 20/5, 2017 at 9:0 Comment(0)
V
1

By server, I'm guessing you mean Tomcat / Jetty / other containers / etc ? You can either deploy each service on its own container (tomcat), or rename the generated WAR file to a.war, b.war, c.war in which case you can access the different services at localhost:8080/a, localhost:8080/b, etc

If you're running JARs, you need to figure out how to run each service on its own port since you can only run one service per port, eg localhost:8081, localhost:8082

Have not used play myself

Veroniqueverras answered 20/5, 2017 at 12:54 Comment(2)
I use netty, one server takes a lot of ram and it seems like one server only can contain one application. so I think to use all the microservices inside one application but each microservice has different path. does it defeat the purpose of microservice architecture?. all the microservices still independent to each otherBreakout
The aim of microservices is to segment applications into smaller, more maintainable, self-contained pieces. The downside is that you often use more resources since you now have to run more than one container. Light-weight standalone web servers that run from a self-contained JAR ( like VertX) made their appearance to meet the need of microservices. Not using microservices is not the end of the world, it's simply a solution for a certain problem, you might not have that problem, especially when starting out a new project.Veroniqueverras

© 2022 - 2024 — McMap. All rights reserved.