Package io.servicetalk.grpc.api
Class GrpcServiceFactory<Service extends GrpcService>
java.lang.Object
io.servicetalk.grpc.api.GrpcServiceFactory<Service>
- Type Parameters:
Service
- Type for service
- Direct Known Subclasses:
Health.ServiceFactory
A factory for binding a gRPC service to a server using a
GrpcServiceFactory.ServerBinder
.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
A utility to bind an HTTP service for gRPC with an appropriate programming model. -
Constructor Summary
ModifierConstructorDescriptionprotected
GrpcServiceFactory
(GrpcRoutes<Service> routes) Creates new instance. -
Method Summary
Modifier and TypeMethodDescriptionfinal Single<GrpcServerContext>
bind
(GrpcServiceFactory.ServerBinder binder, ExecutionContext<?> executionContext) Use the passedGrpcServiceFactory.ServerBinder
to bind an appropriate gRPC service for the server.static GrpcServiceFactory<?>
merge
(GrpcServiceFactory<?>... factories) Merges multiplefactories
into a single instance.
-
Constructor Details
-
GrpcServiceFactory
Creates new instance.- Parameters:
routes
-GrpcRoutes
that will hold the routes for the constructed service.
-
-
Method Details
-
merge
Merges multiplefactories
into a single instance.- Parameters:
factories
- instanes ofGrpcServiceFactory
to merge.- Returns:
- An aggregate
GrpcServiceFactory
.
-
bind
public final Single<GrpcServerContext> bind(GrpcServiceFactory.ServerBinder binder, ExecutionContext<?> executionContext) Use the passedGrpcServiceFactory.ServerBinder
to bind an appropriate gRPC service for the server.- Parameters:
binder
-GrpcServiceFactory.ServerBinder
to bind gRPC service to the server.executionContext
-ExecutionContext
to use for the service.- Returns:
- A
Single
that completes when the server is successfully started or terminates with an error if the server could not be started.
-