I am trying to create a grpc service using Lagom framework following this documentation. Here the hello service also exposes rest API besides grpc service.
Now while creating lagom server in the ApplicationLoader we assign grpc service impl as additionalRouter like so:
abstract class HelloApplication(context: LagomApplicationContext)
extends LagomApplication(context)
with AhcWSComponents {
// Bind the service that this server provides
override lazy val lagomServer =
serverFor[HelloService](wire[HelloServiceImpl])
.additionalRouter(wire[HelloGrpcServiceImpl])
}
Its all fine for the purpose of demo but we may not need to always create a REST endpoint besides gRPC endpoint. In that case I won't need either HelloService or HelloServiceImpl. The problem is how would you create lagom server with only HelloGrpcServiceImpl? I can't see to find a way either any documentation or the APIs itself to be able to achieve this!
Please suggest.
Based on the answer in the link I provided as a comment to my question, the solution would look something like this:
Here we have to create dummy service trait and implementation, namely,
PrimeGeneratorServiceandPrimeGeneratorServiceImpl, respectively.Don't forget to add following in the loader class: