My project has one service (api and impl). How do I create an executable jar for my service. Since Lagom uses the service locator and service gateway for managing services, they need to be included in the jar as well.
To create an executable jar, use sbt-assembly
. Since Lagom is built on Play, the Play sbt-assembly instructions may be useful here.
You can bundle whatever implementation of the service locator you like, if you only have one service though, then you don't need any service locator since that service isn't going to be looking up any other services, you can just provide a ServiceLocator
implementation that returns None
for every lookup. And as far as a service gateway goes, you can't bundle a service gateway inside a service since that defeats the purpose - a service gateway is an HTTP proxy that sits in front of and routes requests to many services. Typically you would use nginx or haproxy.