channel

fun channel(hostName: String = "", port: Int = -1, enableRetry: Boolean = false, maxRetryAttempts: Int = 5, tlsContext: TlsContext, overrideAuthority: String = "", inProcessServerName: String = "", block: ManagedChannelBuilder<*>.() -> Unit): ManagedChannel

Builds a ManagedChannel using either a Netty transport or an in-process transport.

When inProcessServerName is non-empty, an in-process channel is created (ignoring host/port/TLS). Otherwise a Netty channel is created for the given hostName and port.

Return

the built ManagedChannel

Parameters

hostName

the target server hostname (Netty transport only)

port

the target server port (Netty transport only)

enableRetry

whether to enable gRPC retry on the channel

maxRetryAttempts

the maximum number of retry attempts per RPC

tlsContext

the TLS configuration for the channel

overrideAuthority

overrides the authority used for TLS hostname verification

inProcessServerName

if non-empty, creates an in-process channel with this name

block

a configuration block applied to the channel builder before building