Class GrpcManagedChannelFactory

java.lang.Object
io.micronaut.grpc.channels.GrpcManagedChannelFactory
All Implemented Interfaces:
AutoCloseable

@Factory public class GrpcManagedChannelFactory extends Object implements AutoCloseable
Factory bean for creating ManagedChannel instances.
Since:
1.0
Author:
graemerocher
  • Constructor Summary

    Constructors
    Constructor
    Description
    GrpcManagedChannelFactory(io.micronaut.context.ApplicationContext beanContext)
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    protected io.grpc.ManagedChannel
    managedChannel(io.micronaut.inject.InjectionPoint<io.grpc.Channel> injectionPoint)
    Builds a managed channel for the given target.
    io.grpc.ManagedChannel
    stubChannel(io.micronaut.inject.InjectionPoint<?> injectionPoint)
    Returns the channel for a client stub injection point annotated with GrpcChannel.

    Methods inherited from class Object

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

    • GrpcManagedChannelFactory

      public GrpcManagedChannelFactory(io.micronaut.context.ApplicationContext beanContext)
      Default constructor.
      Parameters:
      beanContext - The bean context
  • Method Details

    • managedChannel

      @Bean @Primary protected io.grpc.ManagedChannel managedChannel(io.micronaut.inject.InjectionPoint<io.grpc.Channel> injectionPoint)
      Builds a managed channel for the given target.
      Parameters:
      injectionPoint - The injection point
      Returns:
      The channel
    • stubChannel

      @Internal public io.grpc.ManagedChannel stubChannel(io.micronaut.inject.InjectionPoint<?> injectionPoint)
      Returns the channel for a client stub injection point annotated with GrpcChannel. Called by the stub factories that micronaut-grpc-client-processor generates. All stubs of the same channel share one ManagedChannel, whatever their type or injection point.
      Parameters:
      injectionPoint - The stub injection point
      Returns:
      The channel
      Since:
      5.3.0
    • close

      @PreDestroy public void close()
      Specified by:
      close in interface AutoCloseable