@FunctionalInterface
public interface GrpcChannelSource
GrpcChannelSource is usually where your service discovery logic goes. It is the place where you map the client stubs to their server implementations.
Auto configuration will autodetect the GrpcChannelSource bean and
use it to resolve channels for new gRPC stub instances. In other words
you may register your GrpcChannelSource as a simple @Bean in
your @Configuration classes.
Note that there must be at most one GrpcChannelSource in the ApplicationContext, otherwise you'll get an error.
If no GrpcChannelSource is found in the ApplicationContext, auto configuration will
Channel in the ApplicationContext to use instead;
grpc.client.target;
localhost:6565"
If you're creating a GrpcChannelSource that returns a constant channel,
consider using convenience function GrpcChannelSource.of(Channel)
| Modifier and Type | Method and Description |
|---|---|
static GrpcChannelSource |
of(io.grpc.Channel channel)
Convenience method for build GrpcChannelSource that returns
a constant channel instance.
|
io.grpc.Channel |
resolve(java.lang.Class<? extends io.grpc.stub.AbstractStub<?>> stubClass)
Resolve channel for stub type.
|
io.grpc.Channel resolve(java.lang.Class<? extends io.grpc.stub.AbstractStub<?>> stubClass)
stubClass - the stub typenullstatic GrpcChannelSource of(io.grpc.Channel channel)
channel - the constant channel instance to return