Class GrpcServiceRegistrar

java.lang.Object
io.micronaut.protobuf.json.registry.GrpcServiceRegistrar
All Implemented Interfaces:
io.micronaut.context.processor.AnnotationProcessor<GrpcRestJsonExposed,io.micronaut.inject.ExecutableMethod<?,?>>, io.micronaut.context.processor.ExecutableMethodProcessor<GrpcRestJsonExposed>

@Singleton public class GrpcServiceRegistrar extends Object implements io.micronaut.context.processor.ExecutableMethodProcessor<GrpcRestJsonExposed>
The GrpcServiceRegistrar is responsible for processing methods annotated with @GrpcRestJsonExposed during application startup and registering them with the GrpcServiceRegistry. This enables gRPC methods to be invoked via JSON over REST.
This class implements the ExecutableMethodProcessor interface for the @GrpcRestJsonExposed annotation and ensures that the annotated methods are identified and registered.
The registrar operates at startup to facilitate the integration of gRPC services with REST-based clients by leveraging JSON payloads.
It uses the GrpcServiceRegistry to maintain a mapping of registered methods.
Annotations: - @Singleton: Indicates that this class is a singleton within the application context. - @Experimental: Denotes that the class features experimental functionality and may be prone to modifications in future versions.
Constructor: - Requires a GrpcServiceRegistry instance for method registration.
Logging: - Maintains an internal logger to track the registration process of gRPC methods.
  • Constructor Details

  • Method Details

    • process

      public void process(io.micronaut.inject.BeanDefinition<?> beanDefinition, io.micronaut.inject.ExecutableMethod<?,?> method)
      Processes a bean definition and its executable method annotated with @GrpcRestJsonExposed. Registers the annotated gRPC method with the GrpcServiceRegistry, enabling the method to be invoked via JSON over REST.
      Specified by:
      process in interface io.micronaut.context.processor.AnnotationProcessor<GrpcRestJsonExposed,io.micronaut.inject.ExecutableMethod<?,?>>
      Specified by:
      process in interface io.micronaut.context.processor.ExecutableMethodProcessor<GrpcRestJsonExposed>
      Parameters:
      beanDefinition - the bean definition containing the gRPC service class where the method is defined
      method - the executable method annotated with @GrpcRestJsonExposed to be registered