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 Modifier and Type Field Description static org.slf4j.Loggerlog
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default StringadjustHost(String host)Adjust host, if needed.StringchannelInfo()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.Stringresolver()Get resolver.booleanserverAlreadyExists()Does a server instance already exist.StringserverInfo()Provide server info.voidstartServer(io.grpc.Server server)Start gRPC server.
-
-
-
Method Detail
-
findServerBuilderProvider
static GrpcBuilderProvider findServerBuilderProvider(GrpcServerConfiguration configuration)
Find gRPC server builder provider.- Parameters:
configuration- the gRPC server configuration- Returns:
- provider instance or null if none is provided
-
findChannelBuilderProvider
static GrpcBuilderProvider findChannelBuilderProvider(GrpcClientConfiguration configuration)
Find gRPC client builder provider.- Parameters:
configuration- the gRPC client configuration- Returns:
- provider instance or null if none is provided
-
providesServer
boolean providesServer(GrpcServerConfiguration configuration)
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
void startServer(io.grpc.Server server) throws ExceptionStart gRPC server.- Parameters:
server- the server instance to start- Throws:
Exception- for any exception while starting the server
-
postStartup
void postStartup(io.grpc.Server server, ShutdownContext shutdown)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
String serverInfo()
Provide server info.- Returns:
- simple server info
-
providesChannel
boolean providesChannel(GrpcClientConfiguration configuration)
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
default String adjustHost(String host)
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
String channelInfo()
Provide channel info.- Returns:
- simple channel info
-
-