Interface GrpcServer

    • Method Detail

      • configuration

        GrpcServerConfiguration configuration()
        Gets effective server configuration.
        Returns:
        Server configuration
      • start

        CompletionStage<GrpcServer> start()
        Starts the server. Has no effect if server is running.
        Returns:
        a completion stage of starting process
      • whenShutdown

        CompletionStage<GrpcServer> whenShutdown()
        Completion stage is completed when server is shut down.
        Returns:
        a completion stage of the server
      • shutdown

        CompletionStage<GrpcServer> shutdown()
        Attempt to gracefully shutdown server. It is possible to use returned CompletionStage to react.

        RequestMethod can be called periodically.

        Returns:
        to react on finished shutdown process
        See Also:
        start()
      • healthChecks

        HealthCheck[] healthChecks()
        Return an array of health checks for this server.
        Returns:
        an array of HealthCheck instances for this server
      • isRunning

        boolean isRunning()
        Returns true if the server is currently running. A running server in the stopping phase returns true until it is fully stopped.
        Returns:
        true if server is running
      • port

        int port()
        Returns a port number the default server socket is bound to and is listening on; or -1 if unknown or not active.

        Only supported only when server is running.

        Returns:
        a listen port; or -1 if unknown or the default server socket is not active
      • create

        static GrpcServer create​(Supplier<? extends GrpcServerConfiguration> configurationBuilder,
                                 GrpcRouting routing)
        Creates a new instance from a provided configuration and a GrpcRouting.
        Parameters:
        configurationBuilder - a server configuration builder that will be built as a first step of this method execution; may be null
        routing - a GrpcRouting instance
        Returns:
        a new gRPC server instance
        Throws:
        IllegalStateException - if none SPI implementation found
        NullPointerException - if 'GrpcRouting' parameter is null
      • create

        static GrpcServer create​(Supplier<? extends GrpcServerConfiguration> configurationBuilder,
                                 Supplier<? extends GrpcRouting> routingBuilder)
        Creates new instance form provided configuration and GrpcRouting.
        Parameters:
        configurationBuilder - a server configuration builder that will be built as a first step of this method execution; may be null
        routingBuilder - a GrpcRouting builder that will be built as a second step of this method execution
        Returns:
        a new gRPC server instance
        Throws:
        IllegalStateException - if none SPI implementation found
        NullPointerException - if 'routingBuilder' parameter is null
      • create

        static GrpcServer create​(GrpcServerConfiguration configuration,
                                 Supplier<? extends GrpcRouting> routingBuilder)
        Creates new instance form provided configuration and GrpcRouting.
        Parameters:
        configuration - a server configuration instance
        routingBuilder - a GrpcRouting builder that will be built as a second step of this method execution
        Returns:
        a new gRPC server instance
        Throws:
        IllegalStateException - if none SPI implementation found
        NullPointerException - if 'routingBuilder' parameter is null
      • create

        static GrpcServer create​(GrpcRouting routing)
        Creates new instance form provided GrpcRouting and default configuration.
        Parameters:
        routing - a GrpcRouting instance
        Returns:
        a new gRPC server instance
        Throws:
        IllegalStateException - if none SPI implementation found
        NullPointerException - if 'routing' parameter is null
      • create

        static GrpcServer create​(Supplier<? extends GrpcRouting> routingBuilder)
        Creates new instance form provided GrpcRouting and default configuration.
        Parameters:
        routingBuilder - a GrpcRouting builder instance that will be built as a first step of this method execution
        Returns:
        a new gRPC server instance
        Throws:
        IllegalStateException - if none SPI implementation found
        NullPointerException - if 'GrpcRouting' parameter is null