Annotation Type 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 {
             ...
         };
     
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      String name
      The name of the configured channel or gRPC server host.
    • Element Detail

      • name

        String name
        The name of the configured channel or gRPC server host.
        Returns:
        name of the channel