Class GrpcServiceRegistrar

java.lang.Object
io.micronaut.protobuf.json.registry.GrpcServiceRegistrar
All Implemented Interfaces:
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 Summary

    Constructors
    Constructor
    Description
    GrpcServiceRegistrar(GrpcServiceRegistry registry, io.micronaut.context.ApplicationContext applicationContext)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <B> void
    process(io.micronaut.inject.BeanDefinition<B> beanDefinition, io.micronaut.inject.ExecutableMethod<B,?> method)
    Processes a bean definition and its executable method annotated with @GrpcRestJsonExposed.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GrpcServiceRegistrar

      public GrpcServiceRegistrar(GrpcServiceRegistry registry, io.micronaut.context.ApplicationContext applicationContext)
  • Method Details

    • process

      public <B> void process(io.micronaut.inject.BeanDefinition<B> beanDefinition, io.micronaut.inject.ExecutableMethod<B,?> 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.ExecutableMethodProcessor<GrpcRestJsonExposed>
      Type Parameters:
      B - type parameter annotation
      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