Annotation Interface GrpcService


@Documented @Target(TYPE) public @interface GrpcService
Annotates a class that implements a gRPC service.

Generates several types when annotating a class Foo:

  • Interfaces FooComponent and FooComponent.Factory.
  • Modules FooGrpcProxyModule and FooGrpcServiceModule.

To use these types to configure a server:

  1. Create a subcomponent that implements FooComponent and installs FooGrpcServiceModule.
  2. Install NettyServerModule or another ServerModule subclass and FooGrpcProxyModule into your @Singleton component.
  3. Bind an implementation of FooComponent.Factory in your @Singleton component. The implementation will typically inject the @Singleton component and call subcomponent factory methods to instantiate the correct subcomponent.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The class that gRPC generates from the proto service definition.
  • Element Details

    • grpcClass

      Class<?> grpcClass
      The class that gRPC generates from the proto service definition.