lagom / lagom-samples

https://developer.lightbend.com/start/?group=lagom
Creative Commons Zero v1.0 Universal
86 stars 82 forks source link

Demonstrates usage of DevMode Service Registry portName #146

Closed ignasi35 closed 4 years ago

ignasi35 commented 4 years ago

NOT FOR MERGE

This PR makes the minimal changes on grpc-example-scala so everything runs without relying on unmanagedServices in Lagom's DevMode. There are two steps required:

  1. the target service must bind to the localhost address (instead of the default 127.0.0.1 to pass al SSL Certificate validations)
  2. the gRPC client must lookup the "hello-srvc" name. This operation may fail but eventually succeeds. The reason is that the internal Channel may be built before the hello-srvc is available in which case build fails. The Channel creation is eventually retried.

PS: I've done this on 1.5.x because 1.6.x is affected by https://github.com/akka/akka-grpc/issues/731.

ignasi35 commented 4 years ago

This PR is also useful to verify there's no restriction wrt the remote name when consuming gRPC services. Originally, the gRPC client was restricted to using gRPC-idiomatic names when looking up the remote server. This PR looks up by the Lagom name and, when the endpoint is found, the regular Channel is built.