Confusing about ManagedChannelBuilder.forAddress
See original GitHub issueI have two grpc client.
- one use custom nameresolver and priority > DNSNameResolver
ManagedChannelBuilder.forTarget("my-resolver:///service")
- one use default nameresolver.
ManagedChannelBuilder.forAddress(ip, port)
. I expect it will call DNSNameResolver,but in fact, it call custom resolver.
this is ok
ManagedChannel channel = ManagedChannelBuilder.forAddress(ip,port)
.nameResolverFactory(new DnsNameResolverProvider())
.build()
ManagedChannel channel = ManagedChannelBuilder.forAddress("dns:///ip:port")
.build()
It’s very confusing for ManagedChannel.forAddress
. The behavior will be changed by register NameResolverProvider.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
io.grpc.ManagedChannelBuilder.forAddress java code ...
Creates a {@link io.grpc.ManagedChannelBuilder} preconfigured for the emulator's port. */ private static ManagedChannelBuilder<?> ...
Read more >Channel ManagedChannelImpl was not shut down properly
In my case, I just shutdown the channel in try,finally block: ManagedChannel channel = ManagedChannelBuilder.forAddress... try{ .
Read more >fs2-grpc/Lobby - Gitter
Simple: implicit val sync: Sync[IO] = Sync[IO] val managedChannelStream: Stream[IO, ManagedChannel] = ManagedChannelBuilder.forAddress("127.0.0.1" ...
Read more >ManagedChannelBuilder (grpc-all 1.51.0 API)
Provides a custom executor. static ManagedChannelBuilder<?> forAddress(String name, int port). Creates a channel with the target's ...
Read more >Using TensorFlow models from the JVM using TensorFlow ...
val channel = ManagedChannelBuilder. ... I have been so confused with regards to TensorFlow serving and have not had luck getting this ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You are right.
forAddress()
is one of the oldest APIs of gRPC, before NameResolvers became pluggable. Yes, it uses the scheme of the resolver with the highest priority. This might be a bit surprising and we put some doc onforTarget()
:It may surprise users, but not necessarily be broken. We’d also generally recommend using priorities lower than DNS for custom resolvers to preserve the default behavior for
forAddress()
. But if you know what’s going on, it’s safe to use higher priorities. Anyway, it’s more recommended to useforTarget()
with advanced usages such as providing custom resolvers.Yes, of course.Thank you for your help.