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 Detail

      • log

        static final org.slf4j.Logger log
    • 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 instance
        configuration - the gRPC server configuration
        launchMode - current launch mode
        Returns:
        new ServerBuilder instance
      • startServer

        void startServer​(io.grpc.Server server)
                  throws Exception
        Start 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 server
        shutdown - 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 services
        methods - the methods
        globalInterceptors - the global interceptors
        shutdown - 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​(String host,
                          int port,
                          GrpcServerConfiguration configuration)
        Provide server info.
        Parameters:
        host - server host
        port - server port
        configuration - full server configuration
        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 configuration
        target - the channel target
        Returns:
        new ChannelBuilder
      • channelInfo

        String channelInfo​(GrpcClientConfiguration configuration)
        Provide channel info.
        Parameters:
        configuration - client configuration
        Returns:
        simple channel info