Class GrpcManagedChannelFactory
java.lang.Object
io.micronaut.grpc.channels.GrpcManagedChannelFactory
- All Implemented Interfaces:
AutoCloseable
Factory bean for creating
ManagedChannel instances.- Since:
- 1.0
- Author:
- graemerocher
-
Constructor Summary
ConstructorsConstructorDescriptionGrpcManagedChannelFactory(io.micronaut.context.ApplicationContext beanContext) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected io.grpc.ManagedChannelmanagedChannel(io.micronaut.inject.InjectionPoint<io.grpc.Channel> injectionPoint) Builds a managed channel for the given target.io.grpc.ManagedChannelstubChannel(io.micronaut.inject.InjectionPoint<?> injectionPoint) Returns the channel for a client stub injection point annotated withGrpcChannel.
-
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 withGrpcChannel. Called by the stub factories thatmicronaut-grpc-client-processorgenerates. All stubs of the same channel share oneManagedChannel, 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:
closein interfaceAutoCloseable
-