On Tue, Jun 14, 2016 at 12:54 AM, Benson Wang <benson.w...@symbio.com>
wrote:

> Thanks Eric for your feedback.  Could you give me a clue to use "Name
> Resolvers" to integrate with a service discovery?
>

Implement a NameResolver
<http://www.grpc.io/grpc-java/javadoc/io/grpc/NameResolver.html>. We use
URI schemes to primarily distinguish between resolvers. So a target
<http://www.grpc.io/grpc-java/javadoc/io/grpc/ManagedChannelBuilder.html#forTarget-java.lang.String->
of dns:///google.com would generally use the DnsNameResolver. In the
current version you then register a NameResolver.Factory with
NameResolverRegistry.register()
<http://www.grpc.io/grpc-java/javadoc/io/grpc/NameResolverRegistry.html#register-io.grpc.NameResolver.Factory->.
In the next version this is changing
<https://github.com/grpc/grpc-java/pull/1925>. You would make a
NameResolverProvider and we will load it from the classpath using
ServiceLoader, so no static method calls are necessary before use.

You can find some documentation
<https://github.com/grpc/grpc/blob/master/doc/naming.md> in the primary
grpc repo. But probably the best documentation at this point on targets is the
forTarget() method
<http://www.grpc.io/grpc-java/javadoc/io/grpc/ManagedChannelBuilder.html#forTarget-java.lang.String->
(that
I also linked to earlier).

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To post to this group, send email to grpc-io@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CA%2B4M1oPwZk0tR-7oAt%3Dh98XBzk2%3DmGsLkWNS%3D5CkVGCBsrrOqQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to