Annotation Interface GrpcChannel
@Target({TYPE,METHOD,CONSTRUCTOR,FIELD,PARAMETER})
@Retention(RUNTIME)
@Qualifier
public @interface GrpcChannel
A qualifier annotation that can be used to specify the name of a configured gRPC
channel to inject, or the name of the host to connect to, as described in
GrpcChannelsProvider.channel(String)
documentation.
For example:
@Inject @GrpcChannel(name = "foo") private Channel channel;This annotation can also be specified at the injection point for a client proxy, in combination with the
@GrpcProxy
annotation:
@Inject @GrpcChannel(name = "foo") @GrpcProxy private FooServiceClient client;Alternatively, if the client proxy should always use the same channel, it can be specified on the client interface instead:
@Grpc(name = "FooService") @GrpcChannel(name = "foo") public interface FooServiceClient { ... };
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
AnAnnotationLiteral
for theGrpcChannel
annotation. -
Required Element Summary
-
Element Details
-
name
String nameThe name of the configured channel or gRPC server host.- Returns:
- name of the channel
-