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
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA utility to bind an HTTP service for gRPC with an appropriate programming model. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedGrpcServiceFactory(GrpcRoutes<Service> routes) Creates new instance. -
Method Summary
Modifier and TypeMethodDescriptionfinal Single<GrpcServerContext>bind(GrpcServiceFactory.ServerBinder binder, GrpcServiceConfig serviceConfig) Use the passedGrpcServiceFactory.ServerBinderto bind an appropriate gRPC service for the server.final Single<GrpcServerContext>bind(GrpcServiceFactory.ServerBinder binder, ExecutionContext<?> executionContext) Deprecated.static GrpcServiceFactory<?>merge(GrpcServiceFactory<?>... factories) Merges multiplefactoriesinto a single instance.
-
Constructor Details
-
GrpcServiceFactory
Creates new instance.- Parameters:
routes-GrpcRoutesthat will hold the routes for the constructed service.
-
-
Method Details
-
merge
Merges multiplefactoriesinto a single instance.- Parameters:
factories- instanes ofGrpcServiceFactoryto merge.- Returns:
- An aggregate
GrpcServiceFactory.
-
bind
@Deprecated public final Single<GrpcServerContext> bind(GrpcServiceFactory.ServerBinder binder, ExecutionContext<?> executionContext) Deprecated.Usebind(ServerBinder, GrpcServiceConfig); this overload applies the default inbound message-size limit.Use the passedGrpcServiceFactory.ServerBinderto bind an appropriate gRPC service for the server.- Parameters:
binder-GrpcServiceFactory.ServerBinderto bind gRPC service to the server.executionContext-ExecutionContextto use for the service.- Returns:
- A
Singlethat completes when the server is successfully started or terminates with an error if the server could not be started.
-
bind
public final Single<GrpcServerContext> bind(GrpcServiceFactory.ServerBinder binder, GrpcServiceConfig serviceConfig) Use the passedGrpcServiceFactory.ServerBinderto bind an appropriate gRPC service for the server.- Parameters:
binder-GrpcServiceFactory.ServerBinderto bind gRPC service to the server.serviceConfig-GrpcServiceConfigcontrolling the bound service, including theExecutionContextit runs on and the maximum inbound (request) message size enforced during deserialization.- Returns:
- A
Singlethat completes when the server is successfully started or terminates with an error if the server could not be started.
-
bind(ServerBinder, GrpcServiceConfig); this overload applies the default inbound message-size limit.