Package com.rabbitmq.client
Class ConnectionFactory.NettyConfiguration
java.lang.Object
com.rabbitmq.client.ConnectionFactory.NettyConfiguration
- Enclosing class:
ConnectionFactory
Helper class to configure Netty.
- Since:
- 5.27.0
-
Method Summary
Modifier and TypeMethodDescriptionbootstrapCustomizer(Consumer<io.netty.bootstrap.Bootstrap> bootstrapCustomizer) An extension point to customize Netty'sBootstraps used to configure connections.channelCustomizer(Consumer<io.netty.channel.Channel> channelCustomizer) An extension point to customize Netty'sChannels used for connections.Go back to the connection factory.enqueuingTimeout(Duration enqueuingTimeout) Set the timeout to enqueue outbound frames.eventLoopGroup(io.netty.channel.EventLoopGroup eventLoopGroup) Set theEventLoopGroupshared by all the connections created with this connection factory.sslContext(io.netty.handler.ssl.SslContext sslContext) NettySslContextfor TLS connections.sslContextFactory(Function<String, io.netty.handler.ssl.SslContext> sslContextFactory) A factory to createSslContextdepending on the connection name.
-
Method Details
-
eventLoopGroup
public ConnectionFactory.NettyConfiguration eventLoopGroup(io.netty.channel.EventLoopGroup eventLoopGroup) Set theEventLoopGroupshared by all the connections created with this connection factory.A connection uses a one-thread NIO event loop group if none is provided. It disposes it when it closes itself.
It is recommended to set an event loop group with an appropriate number of threads if connection factory is meant to create a significant number of connections.
It is the developer's responsibility to close the event loop group they provide.
- Parameters:
eventLoopGroup- the event loop group to use- Returns:
- this configuration instance
-
channelCustomizer
public ConnectionFactory.NettyConfiguration channelCustomizer(Consumer<io.netty.channel.Channel> channelCustomizer) An extension point to customize Netty'sChannels used for connections.- Parameters:
channelCustomizer- the customization callback- Returns:
- this configuration instance
-
bootstrapCustomizer
public ConnectionFactory.NettyConfiguration bootstrapCustomizer(Consumer<io.netty.bootstrap.Bootstrap> bootstrapCustomizer) An extension point to customize Netty'sBootstraps used to configure connections.- Parameters:
bootstrapCustomizer- the bootstrap customization callback- Returns:
- this configuration instance
-
sslContext
NettySslContextfor TLS connections.Use
SslContextBuilder.forClient()to configure and create an instance.- Parameters:
sslContext- the SSL context- Returns:
- this configuration instance
-
sslContextFactory
public ConnectionFactory.NettyConfiguration sslContextFactory(Function<String, io.netty.handler.ssl.SslContext> sslContextFactory) A factory to createSslContextdepending on the connection name.- Parameters:
sslContextFactory- the factory- Returns:
- this configuration instance
-
enqueuingTimeout
Set the timeout to enqueue outbound frames.Default is 10 seconds.
- Parameters:
enqueuingTimeout- the enqueuing timeout- Returns:
- this configuration instance
-
connectionFactory
Go back to the connection factory.- Returns:
- the connection factory
-