Class ConnectionFactory.NettyConfiguration

java.lang.Object
com.rabbitmq.client.ConnectionFactory.NettyConfiguration
Enclosing class:
ConnectionFactory

public static final class ConnectionFactory.NettyConfiguration extends Object
Helper class to configure Netty.
Since:
5.27.0
  • Method Details

    • eventLoopGroup

      public ConnectionFactory.NettyConfiguration eventLoopGroup(io.netty.channel.EventLoopGroup eventLoopGroup)
      Set the EventLoopGroup shared 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's Channels 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's Bootstraps used to configure connections.
      Parameters:
      bootstrapCustomizer - the bootstrap customization callback
      Returns:
      this configuration instance
    • sslContext

      public ConnectionFactory.NettyConfiguration sslContext(io.netty.handler.ssl.SslContext sslContext)
      Netty SslContext for 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 create SslContext depending on the connection name.
      Parameters:
      sslContextFactory - the factory
      Returns:
      this configuration instance
    • enqueuingTimeout

      public ConnectionFactory.NettyConfiguration enqueuingTimeout(Duration enqueuingTimeout)
      Set the timeout to enqueue outbound frames.

      Default is 10 seconds.

      Parameters:
      enqueuingTimeout - the enqueuing timeout
      Returns:
      this configuration instance
    • connectionFactory

      public ConnectionFactory connectionFactory()
      Go back to the connection factory.
      Returns:
      the connection factory