@ExperimentalApi(value="There is no plan to make this API stable, given transport API instability") public class NettyChannelBuilder extends io.grpc.internal.AbstractManagedChannelImplBuilder<NettyChannelBuilder>
Modifier and Type | Class and Description |
---|---|
protected static class |
NettyChannelBuilder.NettyTransportFactory
Creates Netty transports.
|
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_FLOW_CONTROL_WINDOW |
Modifier | Constructor and Description |
---|---|
protected |
NettyChannelBuilder(SocketAddress address) |
protected |
NettyChannelBuilder(String target) |
protected |
NettyChannelBuilder(String host,
int port) |
Modifier and Type | Method and Description |
---|---|
protected io.grpc.internal.ClientTransportFactory |
buildTransportFactory() |
NettyChannelBuilder |
channelType(Class<? extends Channel> channelType)
Specify the channel type to use, by default we use
NioSocketChannel . |
NettyChannelBuilder |
eventLoopGroup(EventLoopGroup eventLoopGroup)
Provides an EventGroupLoop to be used by the netty transport.
|
NettyChannelBuilder |
flowControlWindow(int flowControlWindow)
Sets the flow control window in bytes.
|
static NettyChannelBuilder |
forAddress(SocketAddress serverAddress)
Creates a new builder with the given server address.
|
static NettyChannelBuilder |
forAddress(String host,
int port)
Creates a new builder with the given host and port.
|
static NettyChannelBuilder |
forTarget(String target)
Creates a new builder with the given target string that will be resolved by
NameResolver . |
protected io.grpc.Attributes |
getNameResolverParams() |
NettyChannelBuilder |
maxHeaderListSize(int maxHeaderListSize)
Sets the maximum size of header list allowed to be received on the channel.
|
NettyChannelBuilder |
maxMessageSize(int maxMessageSize)
Sets the maximum message size allowed to be received on the channel.
|
NettyChannelBuilder |
negotiationType(NegotiationType type)
Sets the negotiation type for the HTTP/2 connection.
|
NettyChannelBuilder |
protocolNegotiator(ProtocolNegotiator protocolNegotiator)
Sets the
ProtocolNegotiator to be used. |
NettyChannelBuilder |
sslContext(SslContext sslContext)
SSL/TLS context to use instead of the system default.
|
NettyChannelBuilder |
usePlaintext(boolean skipNegotiation)
|
public static final int DEFAULT_FLOW_CONTROL_WINDOW
protected NettyChannelBuilder(String host, int port)
protected NettyChannelBuilder(String target)
protected NettyChannelBuilder(SocketAddress address)
public static NettyChannelBuilder forAddress(SocketAddress serverAddress)
forAddress(String, int)
should
generally be preferred over this method, since that API permits delaying DNS lookups and
noticing changes to DNS.public static NettyChannelBuilder forAddress(String host, int port)
public static NettyChannelBuilder forTarget(String target)
NameResolver
.public final NettyChannelBuilder channelType(Class<? extends Channel> channelType)
NioSocketChannel
.public final NettyChannelBuilder negotiationType(NegotiationType type)
Default: TLS
@Internal public final NettyChannelBuilder protocolNegotiator(@Nullable ProtocolNegotiator protocolNegotiator)
ProtocolNegotiator
to be used. If non-null
, overrides the value
specified in negotiationType(NegotiationType)
or usePlaintext(boolean)
.
Default: null
.
public final NettyChannelBuilder eventLoopGroup(@Nullable EventLoopGroup eventLoopGroup)
It's an optional parameter. If the user has not provided an EventGroupLoop when the channel is built, the builder will use the default one which is static.
The channel won't take ownership of the given EventLoopGroup. It's caller's responsibility to shut it down when it's desired.
public final NettyChannelBuilder sslContext(SslContext sslContext)
GrpcSslContexts
, but options could have been overridden.public final NettyChannelBuilder flowControlWindow(int flowControlWindow)
DEFAULT_FLOW_CONTROL_WINDOW
).public final NettyChannelBuilder maxMessageSize(int maxMessageSize)
GrpcUtil.DEFAULT_MAX_MESSAGE_SIZE
.public final NettyChannelBuilder maxHeaderListSize(int maxHeaderListSize)
GrpcUtil.DEFAULT_MAX_HEADER_LIST_SIZE
.public final NettyChannelBuilder usePlaintext(boolean skipNegotiation)
usePlaintext
in class io.grpc.ManagedChannelBuilder<NettyChannelBuilder>
protected io.grpc.internal.ClientTransportFactory buildTransportFactory()
buildTransportFactory
in class io.grpc.internal.AbstractManagedChannelImplBuilder<NettyChannelBuilder>
protected io.grpc.Attributes getNameResolverParams()
getNameResolverParams
in class io.grpc.internal.AbstractManagedChannelImplBuilder<NettyChannelBuilder>