public class NettyGrpcServerFactory extends java.lang.Object implements GrpcServerFactory
Constructor and Description |
---|
NettyGrpcServerFactory(GrpcServerProperties properties)
Creates a new netty server factory with the given properties.
|
Modifier and Type | Method and Description |
---|---|
void |
addCodec(GrpcCodecDefinition codec)
Adds the given grpc codec definition to this factory.
|
void |
addService(GrpcServiceDefinition service)
Adds the given grpc service definition to this factory.
|
protected void |
configure(io.grpc.netty.NettyServerBuilder builder)
Configures the given netty server builder.
|
protected void |
configureCodecs(io.grpc.netty.NettyServerBuilder builder)
Configures the codecs that should be supported by the server.
|
protected void |
configureLimits(io.grpc.netty.NettyServerBuilder builder)
Configures limits such as max message sizes that should be used by the server.
|
protected void |
configureSecurity(io.grpc.netty.NettyServerBuilder builder)
Configures the security options that should be used by the server.
|
protected void |
configureServices(io.grpc.netty.NettyServerBuilder builder)
Configures the services that should be served by the server.
|
io.grpc.Server |
createServer()
Creates a new grpc server with the stored options.
|
void |
destroy()
Destroys this factory.
|
java.lang.String |
getAddress()
Gets the IP address the created server will be bound to.
|
int |
getPort()
Gets the local port the created server will use to listen to requests.
|
public NettyGrpcServerFactory(GrpcServerProperties properties)
properties
- The properties used to configure the server.public io.grpc.Server createServer()
GrpcServerFactory
createServer
in interface GrpcServerFactory
protected void configure(io.grpc.netty.NettyServerBuilder builder)
builder
- The server builder to configure.protected void configureServices(io.grpc.netty.NettyServerBuilder builder)
builder
- The server builder to configure.protected void configureSecurity(io.grpc.netty.NettyServerBuilder builder)
builder
- The server builder to configure.protected void configureLimits(io.grpc.netty.NettyServerBuilder builder)
builder
- The server builder to configure.protected void configureCodecs(io.grpc.netty.NettyServerBuilder builder)
builder
- The server builder to configure.public java.lang.String getAddress()
GrpcServerFactory
getAddress
in interface GrpcServerFactory
public int getPort()
GrpcServerFactory
getPort
in interface GrpcServerFactory
public void addService(GrpcServiceDefinition service)
GrpcServerFactory
Note: Adding a service does not effect servers that have already been created.
addService
in interface GrpcServerFactory
service
- The service to add to the grpc server.public void addCodec(GrpcCodecDefinition codec)
GrpcServerFactory
Note: Adding a codec does not effect servers that have already been created.
addCodec
in interface GrpcServerFactory
codec
- The codec to add to the grpc server.public void destroy()
GrpcServerFactory
destroy
in interface GrpcServerFactory