Package io.quarkus.grpc.spi
Interface GrpcBuilderProvider<S extends io.grpc.ServerBuilder<S>>
public interface GrpcBuilderProvider<S extends io.grpc.ServerBuilder<S>>
Allow for additional types of gRPC server and channels to be used / built.
This is an experimental SPI, subject to change.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault StringadjustHost(String host) Adjust host, if needed.channelInfo(GrpcClientConfiguration configuration) Provide channel info.io.grpc.ManagedChannelBuilder<?>createChannelBuilder(GrpcClientConfiguration configuration, String target) Create initial channel builder.io.grpc.ServerBuilder<S>createServerBuilder(io.vertx.core.Vertx vertx, GrpcServerConfiguration configuration, LaunchMode launchMode) Create initial server builder.voiddevModeReload(List<io.grpc.ServerServiceDefinition> servicesWithInterceptors, Map<String, io.grpc.ServerMethodDefinition<?, ?>> methods, List<io.grpc.ServerInterceptor> globalInterceptors, ShutdownContext shutdown) Handle dev mode reload.static GrpcBuilderProviderfindChannelBuilderProvider(GrpcClientConfiguration configuration) Find gRPC client builder provider.static GrpcBuilderProviderfindServerBuilderProvider(GrpcServerConfiguration configuration) Find gRPC server builder provider.voidpostStartup(io.grpc.Server server, ShutdownContext shutdown) Post startup.booleanprovidesChannel(GrpcClientConfiguration configuration) Does this builder provider provide a new gRPC channel instance.booleanprovidesServer(GrpcServerConfiguration configuration) Does this builder provider provide a new gRPC server instance.resolver()Get resolver.booleanDoes a server instance already exist.serverInfo(String host, int port, GrpcServerConfiguration configuration) Provide server info.voidstartServer(io.grpc.Server server) Start gRPC server.
-
Field Details
-
log
static final org.slf4j.Logger log
-
-
Method Details
-
findServerBuilderProvider
Find gRPC server builder provider.- Parameters:
configuration- the gRPC server configuration- Returns:
- provider instance or null if none is provided
-
findChannelBuilderProvider
Find gRPC client builder provider.- Parameters:
configuration- the gRPC client configuration- Returns:
- provider instance or null if none is provided
-
providesServer
Does this builder provider provide a new gRPC server instance.- Parameters:
configuration- the gRPC server configuration- Returns:
- true if yes, false if no
-
createServerBuilder
io.grpc.ServerBuilder<S> createServerBuilder(io.vertx.core.Vertx vertx, GrpcServerConfiguration configuration, LaunchMode launchMode) Create initial server builder.- Parameters:
vertx- the Vertx instanceconfiguration- the gRPC server configurationlaunchMode- current launch mode- Returns:
- new ServerBuilder instance
-
startServer
Start gRPC server.- Parameters:
server- the server instance to start- Throws:
Exception- for any exception while starting the server
-
postStartup
Post startup.- Parameters:
server- the started servershutdown- the shutdown hook
-
devModeReload
void devModeReload(List<io.grpc.ServerServiceDefinition> servicesWithInterceptors, Map<String, io.grpc.ServerMethodDefinition<?, ?>> methods, List<io.grpc.ServerInterceptor> globalInterceptors, ShutdownContext shutdown) Handle dev mode reload.- Parameters:
servicesWithInterceptors- the servicesmethods- the methodsglobalInterceptors- the global interceptorsshutdown- the shutdown hook
-
serverAlreadyExists
boolean serverAlreadyExists()Does a server instance already exist.- Returns:
- true if a server instance already exists, false otherwise
-
serverInfo
Provide server info.- Parameters:
host- server hostport- server portconfiguration- full server configuration- Returns:
- simple server info
-
providesChannel
Does this builder provider provide a new gRPC channel instance.- Parameters:
configuration- the gRPC client configuration- Returns:
- true if yes, false if no
-
resolver
String resolver()Get resolver.- Returns:
- the resolver
-
adjustHost
Adjust host, if needed. By default, no adjustment is made.- Parameters:
host- the host- Returns:
- adjusted host, if needed
-
createChannelBuilder
io.grpc.ManagedChannelBuilder<?> createChannelBuilder(GrpcClientConfiguration configuration, String target) Create initial channel builder.- Parameters:
configuration- the gRPC client configurationtarget- the channel target- Returns:
- new ChannelBuilder
-
channelInfo
Provide channel info.- Parameters:
configuration- client configuration- Returns:
- simple channel info
-