public interface GrpcServerBuilder
| Modifier and Type | Interface and Description |
|---|---|
static interface |
GrpcServerBuilder.HttpInitializer
Initializes the underlying
HttpServerBuilder used for the transport layer. |
| Modifier and Type | Method and Description |
|---|---|
GrpcServerBuilder |
defaultTimeout(Duration defaultTimeout)
Set a default timeout during which gRPC calls are expected to complete.
|
default GrpcServerBuilder |
defaultTimeout(Duration defaultTimeout,
boolean appendTimeoutFilter)
Set a default timeout during which gRPC calls are expected to complete.
|
GrpcServerBuilder |
initializeHttp(GrpcServerBuilder.HttpInitializer initializer)
Set a function which can configure the underlying
HttpServerBuilder used for the transport layer. |
GrpcServerBuilder |
lifecycleObserver(GrpcLifecycleObserver lifecycleObserver)
Sets a
GrpcLifecycleObserver that provides visibility into gRPC lifecycle events. |
Single<GrpcServerContext> |
listen(GrpcBindableService<?>... services)
Starts this server and returns the
GrpcServerContext after the server has been successfully started. |
Single<GrpcServerContext> |
listen(GrpcServiceFactory<?>... serviceFactories)
Starts this server and returns the
GrpcServerContext after the server has been successfully started. |
GrpcServerContext |
listenAndAwait(GrpcBindableService<?>... services)
Starts this server and returns the
GrpcServerContext after the server has been successfully started. |
GrpcServerContext |
listenAndAwait(GrpcServiceFactory<?>... serviceFactories)
Starts this server and returns the
GrpcServerContext after the server has been successfully started. |
GrpcServerBuilder initializeHttp(GrpcServerBuilder.HttpInitializer initializer)
HttpServerBuilder used for the transport layer.initializer - Initializes the underlying HTTP transport builder.this.GrpcServerBuilder defaultTimeout(Duration defaultTimeout)
defaultTimeout - Duration of default timeout which must be positive non-zero.this.defaultTimeout(Duration, boolean)default GrpcServerBuilder defaultTimeout(@Nullable Duration defaultTimeout, boolean appendTimeoutFilter)
defaultTimeout - Duration of default timeout which must be positive non-zero, or null if a
default shouldn't be applied.appendTimeoutFilter - true to append the filter that enforces
deadline propagation. false to not append the filter and
therefore not enforce deadlines. If false you can manually insert
GrpcFilters.newGrpcDeadlineServerFilterFactory(Duration) in your preferred order use
initializeHttp(io.servicetalk.grpc.api.GrpcServerBuilder.HttpInitializer) and
HttpServerBuilder.appendNonOffloadingServiceFilter(StreamingHttpServiceFilterFactory) (to force ordering
before any offloading filters) or
HttpServerBuilder.appendServiceFilter(StreamingHttpServiceFilterFactory) (if you require different
ordering).this.GrpcServerBuilder lifecycleObserver(GrpcLifecycleObserver lifecycleObserver)
GrpcLifecycleObserver that provides visibility into gRPC lifecycle events.
Note, if initializeHttp(HttpInitializer) is used to configure
HttpServerBuilder.lifecycleObserver(HttpLifecycleObserver) – that will override the value specified
using this method. Please choose only one approach.
lifecycleObserver - A GrpcLifecycleObserver that provides visibility into gRPC lifecycle events.this.Single<GrpcServerContext> listen(GrpcBindableService<?>... services)
GrpcServerContext after the server has been successfully started.
If the underlying protocol (eg. TCP) supports it this will result in a socket bind/listen on address.
services - GrpcBindableService(s) to create a gRPC service.Single that completes when the server is successfully started or terminates with an error if
the server could not be started.Single<GrpcServerContext> listen(GrpcServiceFactory<?>... serviceFactories)
GrpcServerContext after the server has been successfully started.
If the underlying protocol (eg. TCP) supports it this will result in a socket bind/listen on address.
serviceFactories - GrpcServiceFactory(s) to create a gRPC service.Single that completes when the server is successfully started or terminates with an error if
the server could not be started.GrpcServerContext listenAndAwait(GrpcServiceFactory<?>... serviceFactories) throws Exception
GrpcServerContext after the server has been successfully started.
If the underlying protocol (eg. TCP) supports it this will result in a socket bind/listen on address.
serviceFactories - GrpcServiceFactory(s) to create a gRPC service.GrpcServerContext by blocking the calling thread until the server is successfully started or
throws an Exception if the server could not be started.Exception - if the server could not be started.GrpcServerContext listenAndAwait(GrpcBindableService<?>... services) throws Exception
GrpcServerContext after the server has been successfully started.
If the underlying protocol (eg. TCP) supports it this will result in a socket bind/listen on address.
services - GrpcBindableService(s) to create a gRPC service.GrpcServerContext by blocking the calling thread until the server is successfully started or
throws an Exception if the server could not be started.Exception - if the server could not be started.