Class ConnectionPolicy.Builder
java.lang.Object
org.apache.pulsar.client.api.v5.config.ConnectionPolicy.Builder
- Enclosing class:
ConnectionPolicy
Builder for
ConnectionPolicy.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Build theConnectionPolicy.callbackThreads(int callbackThreads) Number of threads for message listener callbacks.connectionBackoff(BackoffPolicy connectionBackoff) Backoff strategy for broker reconnection attempts.connectionMaxIdleTime(Duration connectionMaxIdleTime) Maximum idle time before a connection is closed.connectionsPerBroker(int connectionsPerBroker) Maximum number of TCP connections per broker.connectionTimeout(Duration connectionTimeout) Timeout for establishing a TCP connection to the broker.enableTcpNoDelay(boolean enableTcpNoDelay) Enable TCP no-delay (disable Nagle's algorithm).ioThreads(int ioThreads) Number of I/O threads for managing connections and reading data.keepAliveInterval(Duration keepAliveInterval) Interval for sending keep-alive probes on idle connections.proxy(String proxyServiceUrl, ProxyProtocol proxyProtocol) Connect through a proxy.
-
Method Details
-
connectionTimeout
Timeout for establishing a TCP connection to the broker.- Parameters:
connectionTimeout- the maximum duration to wait for a TCP connection- Returns:
- this builder
-
connectionsPerBroker
Maximum number of TCP connections per broker.- Parameters:
connectionsPerBroker- the number of connections to maintain per broker- Returns:
- this builder
-
enableTcpNoDelay
Enable TCP no-delay (disable Nagle's algorithm). Default istrue.- Parameters:
enableTcpNoDelay-trueto enable TCP no-delay- Returns:
- this builder
-
keepAliveInterval
Interval for sending keep-alive probes on idle connections.- Parameters:
keepAliveInterval- the duration between keep-alive probes- Returns:
- this builder
-
connectionMaxIdleTime
Maximum idle time before a connection is closed.- Parameters:
connectionMaxIdleTime- the maximum idle duration- Returns:
- this builder
-
ioThreads
Number of I/O threads for managing connections and reading data.- Parameters:
ioThreads- the number of I/O threads- Returns:
- this builder
-
callbackThreads
Number of threads for message listener callbacks.- Parameters:
callbackThreads- the number of callback threads- Returns:
- this builder
-
proxy
Connect through a proxy.- Parameters:
proxyServiceUrl- the URL of the proxy serviceproxyProtocol- the protocol to use when connecting through the proxy- Returns:
- this builder
-
connectionBackoff
Backoff strategy for broker reconnection attempts.- Parameters:
connectionBackoff- the backoff policy to use when reconnecting to the broker- Returns:
- this builder
- See Also:
-
build
Build theConnectionPolicy.- Returns:
- a new
ConnectionPolicyinstance
-