apache / pekko-grpc

Apache Pekko gRPC
https://pekko.apache.org/
Apache License 2.0
39 stars 17 forks source link

Avoid deprecated nameResolverFactory #296

Open laglangyue opened 5 months ago

laglangyue commented 5 months ago

I was reading the code for name solver and found a todo item, hoping to resolve it.

motivation

same issue in akka-grpc https://github.com/akka/akka-grpc/issues/1092

code in pekko org.apache.pekko.grpc.internal.NettyClientUtils

https://github.com/apache/pekko-grpc/blob/7f4b94cf7200be1506449da86d5811246c87af0d/runtime/src/main/scala/org/apache/pekko/grpc/internal/NettyClientUtils.scala#L49-L64

changes

according to grpc-java

https://github.com/grpc/grpc-java/blob/497e1552172632107574d67d7c092a3f5a39a980/examples/src/main/java/io/grpc/examples/nameresolve/NameResolveClient.java#L39

we just need

NameResolverRegistry.getDefaultRegistry.register(
      new PekkoDiscoveryNameResolverProvider(
        settings.serviceDiscovery,
        settings.defaultPort,
        settings.serviceName,
        settings.servicePortName,
        settings.serviceProtocol,
        settings.resolveTimeout))
laglangyue commented 5 months ago

@raboof Akka's issue was created by you. Do you have any ideas? Should we add a PekkoNameResolverRegister to wrapper the NameResolverRegistry in grpc-java?