Class ClientFactoryOptions

All Implemented Interfaces:
Iterable<ClientFactoryOptionValue<Object>>

public final class ClientFactoryOptions extends AbstractOptions<ClientFactoryOption<Object>,ClientFactoryOptionValue<Object>>
A set of ClientFactoryOptions and their respective values.
  • Field Details

    • WORKER_GROUP

      public static final ClientFactoryOption<io.netty.channel.EventLoopGroup> WORKER_GROUP
      The worker EventLoopGroup.
    • SHUTDOWN_WORKER_GROUP_ON_CLOSE

      public static final ClientFactoryOption<Boolean> SHUTDOWN_WORKER_GROUP_ON_CLOSE
      Whether to shut down the worker EventLoopGroup when the ClientFactory is closed.
    • EVENT_LOOP_SCHEDULER_FACTORY

      public static final ClientFactoryOption<Function<? super io.netty.channel.EventLoopGroup,? extends EventLoopScheduler>> EVENT_LOOP_SCHEDULER_FACTORY
      The factory that creates an EventLoopScheduler which is responsible for assigning an EventLoop to handle a connection to the specified Endpoint.
    • TLS_CUSTOMIZER

      public static final ClientFactoryOption<Consumer<? super io.netty.handler.ssl.SslContextBuilder>> TLS_CUSTOMIZER
      The Consumer which can arbitrarily configure the SslContextBuilder that will be applied to the SSL session.
    • TLS_ALLOW_UNSAFE_CIPHERS

      @Deprecated public static final ClientFactoryOption<Boolean> TLS_ALLOW_UNSAFE_CIPHERS
      Deprecated.
      It's not recommended to enable this option. Use it only when you have no other way to communicate with an insecure peer than this.
      Whether to allow the bad cipher suites listed in RFC7540 for TLS handshake.

      Note that enabling this option increases the security risk of your connection. Use it only when you must communicate with a legacy system that does not support secure cipher suites. See Section 9.2.2, RFC7540 for more information.

    • ADDRESS_RESOLVER_GROUP_FACTORY

      public static final ClientFactoryOption<Function<? super io.netty.channel.EventLoopGroup,? extends io.netty.resolver.AddressResolverGroup<? extends InetSocketAddress>>> ADDRESS_RESOLVER_GROUP_FACTORY
      The factory that creates an AddressResolverGroup which resolves remote addresses into InetSocketAddresses.
    • HTTP2_INITIAL_CONNECTION_WINDOW_SIZE

      public static final ClientFactoryOption<Integer> HTTP2_INITIAL_CONNECTION_WINDOW_SIZE
    • HTTP2_INITIAL_STREAM_WINDOW_SIZE

      public static final ClientFactoryOption<Integer> HTTP2_INITIAL_STREAM_WINDOW_SIZE
      The SETTINGS_INITIAL_WINDOW_SIZE for HTTP/2 stream-level flow control.
    • HTTP2_MAX_FRAME_SIZE

      public static final ClientFactoryOption<Integer> HTTP2_MAX_FRAME_SIZE
      The SETTINGS_MAX_FRAME_SIZE that indicates the size of the largest frame payload that this client is willing to receive.
    • HTTP2_MAX_HEADER_LIST_SIZE

      public static final ClientFactoryOption<Long> HTTP2_MAX_HEADER_LIST_SIZE
      The HTTP/2 SETTINGS_MAX_HEADER_LIST_SIZE that indicates the maximum size of header list that the client is prepared to accept, in octets.
    • HTTP1_MAX_INITIAL_LINE_LENGTH

      public static final ClientFactoryOption<Integer> HTTP1_MAX_INITIAL_LINE_LENGTH
      The maximum length of an HTTP/1 response initial line.
    • HTTP1_MAX_HEADER_SIZE

      public static final ClientFactoryOption<Integer> HTTP1_MAX_HEADER_SIZE
      The maximum length of all headers in an HTTP/1 response.
    • HTTP1_MAX_CHUNK_SIZE

      public static final ClientFactoryOption<Integer> HTTP1_MAX_CHUNK_SIZE
      The maximum length of each chunk in an HTTP/1 response content.
    • IDLE_TIMEOUT_MILLIS

      public static final ClientFactoryOption<Long> IDLE_TIMEOUT_MILLIS
      The idle timeout of a socket connection in milliseconds.
    • KEEP_ALIVE_ON_PING

      @UnstableApi public static final ClientFactoryOption<Boolean> KEEP_ALIVE_ON_PING
      If the idle timeout is reset when an HTTP/2 PING frame or the response of "OPTIONS * HTTP/1.1" is received.
    • PING_INTERVAL_MILLIS

      public static final ClientFactoryOption<Long> PING_INTERVAL_MILLIS
      The PING interval in milliseconds. When neither read nor write was performed for the specified period of time, a PING frame is sent for HTTP/2 or an OPTIONS request with an asterisk ("*") is sent for HTTP/1.
    • MAX_CONNECTION_AGE_MILLIS

      public static final ClientFactoryOption<Long> MAX_CONNECTION_AGE_MILLIS
      The client-side max age of a connection for keep-alive in milliseconds. If the value is greater than 0, a connection is disconnected after the specified amount of time since the connection was established. This option is disabled by default, which means unlimited.
    • MAX_NUM_REQUESTS_PER_CONNECTION

      public static final ClientFactoryOption<Integer> MAX_NUM_REQUESTS_PER_CONNECTION
      The client-side maximum allowed number of requests that can be sent through one connection. This option is disabled by default, which means unlimited.
    • USE_HTTP2_PREFACE

      public static final ClientFactoryOption<Boolean> USE_HTTP2_PREFACE
      Whether to send an HTTP/2 preface string instead of an HTTP/1 upgrade request to negotiate the protocol version of a cleartext HTTP connection.
    • PREFER_HTTP1

      @UnstableApi public static final ClientFactoryOption<Boolean> PREFER_HTTP1
      Whether to use HTTP/1.1 instead of HTTP/2. If enabled, the client will not attempt to upgrade to HTTP/2 for SessionProtocol.HTTP and SessionProtocol.HTTPS.
    • USE_HTTP2_WITHOUT_ALPN

      @UnstableApi public static final ClientFactoryOption<Boolean> USE_HTTP2_WITHOUT_ALPN
      Whether to use HTTP/2 without ALPN. This is useful if you want to communicate with an HTTP/2 server over TLS but the server does not support ALPN.
    • USE_HTTP1_PIPELINING

      public static final ClientFactoryOption<Boolean> USE_HTTP1_PIPELINING
      Whether to use HTTP pipelining for HTTP/1 connections.
    • CONNECTION_POOL_LISTENER

      public static final ClientFactoryOption<ConnectionPoolListener> CONNECTION_POOL_LISTENER
      The listener which is notified on a connection pool event.
    • METER_REGISTRY

      public static final ClientFactoryOption<io.micrometer.core.instrument.MeterRegistry> METER_REGISTRY
      The MeterRegistry which collects various stats.
    • PROXY_CONFIG_SELECTOR

      public static final ClientFactoryOption<ProxyConfigSelector> PROXY_CONFIG_SELECTOR
      The ProxyConfigSelector which determines the ProxyConfig to be used.
    • HTTP1_HEADER_NAMING

      public static final ClientFactoryOption<Http1HeaderNaming> HTTP1_HEADER_NAMING
      The Http1HeaderNaming which converts a lower-cased HTTP/2 header name into another HTTP/1 header name.
    • CHANNEL_OPTIONS

      public static final ClientFactoryOption<Map<io.netty.channel.ChannelOption<?>,Object>> CHANNEL_OPTIONS
      The ChannelOptions of the sockets created by the ClientFactory.
    • CHANNEL_PIPELINE_CUSTOMIZER

      @UnstableApi public static final ClientFactoryOption<Consumer<? super io.netty.channel.ChannelPipeline>> CHANNEL_PIPELINE_CUSTOMIZER
      The Consumer that customizes the Netty ChannelPipeline. This customizer is run right before ChannelOutboundInvoker.connect(SocketAddress) is invoked by Armeria. This customizer is no-op by default.

      Note that usage of this customizer is an advanced feature and may produce unintended side effects, including complete breakdown. It is not recommended if you are not familiar with Armeria and Netty internals.

  • Method Details

    • of

      public static ClientFactoryOptions of()
      Returns an empty singleton ClientFactoryOptions.
    • of

      public static ClientFactoryOptions of(ClientFactoryOptionValue<?>... values)
      Returns the ClientFactoryOptions with the specified ClientFactoryOptionValues.
    • of

      public static ClientFactoryOptions of(Iterable<? extends ClientFactoryOptionValue<?>> values)
      Returns the ClientFactoryOptions with the specified ClientFactoryOptionValues.
    • of

      public static ClientFactoryOptions of(ClientFactoryOptions baseOptions, ClientFactoryOptionValue<?>... additionalValues)
      Returns:
      the merged ClientFactoryOptions
    • of

      public static ClientFactoryOptions of(ClientFactoryOptions baseOptions, Iterable<? extends ClientFactoryOptionValue<?>> additionalValues)
      Returns:
      the merged ClientFactoryOptions
    • workerGroup

      public io.netty.channel.EventLoopGroup workerGroup()
      Returns the worker EventLoopGroup.
    • shutdownWorkerGroupOnClose

      public boolean shutdownWorkerGroupOnClose()
      Returns the flag whether to shut down the worker EventLoopGroup when the ClientFactory is closed.
    • eventLoopSchedulerFactory

      public Function<? super io.netty.channel.EventLoopGroup,? extends EventLoopScheduler> eventLoopSchedulerFactory()
      Returns the factory that creates an EventLoopScheduler which is responsible for assigning an EventLoop to handle a connection to the specified Endpoint.
    • channelOptions

      public Map<io.netty.channel.ChannelOption<?>,Object> channelOptions()
      Returns the ChannelOptions of the sockets created by the ClientFactory.
    • tlsCustomizer

      public Consumer<? super io.netty.handler.ssl.SslContextBuilder> tlsCustomizer()
      Returns the Consumer which can arbitrarily configure the SslContextBuilder that will be applied to the SSL session.
    • addressResolverGroupFactory

      public Function<? super io.netty.channel.EventLoopGroup,? extends io.netty.resolver.AddressResolverGroup<? extends InetSocketAddress>> addressResolverGroupFactory()
      Returns the factory that creates an AddressResolverGroup which resolves remote addresses into InetSocketAddresses.
    • http2InitialConnectionWindowSize

      public int http2InitialConnectionWindowSize()
    • http2InitialStreamWindowSize

      public int http2InitialStreamWindowSize()
      Returns the SETTINGS_INITIAL_WINDOW_SIZE for HTTP/2 stream-level flow control.
    • http2MaxFrameSize

      public int http2MaxFrameSize()
      Returns the SETTINGS_MAX_FRAME_SIZE that indicates the size of the largest frame payload that this client is willing to receive.
    • http2MaxHeaderListSize

      public long http2MaxHeaderListSize()
      Returns the HTTP/2 SETTINGS_MAX_HEADER_LIST_SIZE that indicates the maximum size of header list that the client is prepared to accept, in octets.
    • http1MaxInitialLineLength

      public int http1MaxInitialLineLength()
      Returns the maximum length of an HTTP/1 response initial line.
    • http1MaxHeaderSize

      public int http1MaxHeaderSize()
      Returns the maximum length of all headers in an HTTP/1 response.
    • http1MaxChunkSize

      public int http1MaxChunkSize()
      Returns the maximum length of each chunk in an HTTP/1 response content.
    • idleTimeoutMillis

      public long idleTimeoutMillis()
      Returns the idle timeout of a socket connection in milliseconds.
    • keepAliveOnPing

      @UnstableApi public boolean keepAliveOnPing()
      Returns whether to keep connection alive when an HTTP/2 PING frame or the response of "OPTIONS * HTTP/1.1" is received.
    • pingIntervalMillis

      public long pingIntervalMillis()
      Returns the PING interval in milliseconds. When neither read nor write was performed for the specified period of time, a PING frame is sent for HTTP/2 or an OPTIONS request with an asterisk ("*") is sent for HTTP/1.
    • maxConnectionAgeMillis

      public long maxConnectionAgeMillis()
      Returns the client-side max age of a connection for keep-alive in milliseconds. If the value is greater than 0, a connection is disconnected after the specified amount of the time since the connection was established.
    • maxNumRequestsPerConnection

      public int maxNumRequestsPerConnection()
      Returns the client-side maximum allowed number of requests that can be sent through one connection.
    • useHttp2Preface

      public boolean useHttp2Preface()
      Returns whether to send an HTTP/2 preface string instead of an HTTP/1 upgrade request to negotiate the protocol version of a cleartext HTTP connection.
    • preferHttp1

      @UnstableApi public boolean preferHttp1()
      Returns whether to use HTTP/1.1 instead of HTTP/2 . If true, the client will not attempt to upgrade to HTTP/2 for SessionProtocol.HTTP and SessionProtocol.HTTPS.
    • useHttp2WithoutAlpn

      @UnstableApi public boolean useHttp2WithoutAlpn()
      Returns whether to use HTTP/2 over TLS without ALPN.
    • useHttp1Pipelining

      public boolean useHttp1Pipelining()
      Returns whether to use HTTP pipelining for HTTP/1 connections.
    • connectionPoolListener

      public ConnectionPoolListener connectionPoolListener()
      Returns the listener which is notified on a connection pool event.
    • meterRegistry

      public io.micrometer.core.instrument.MeterRegistry meterRegistry()
      Returns the MeterRegistry which collects various stats.
    • proxyConfigSelector

      public ProxyConfigSelector proxyConfigSelector()
      The ProxyConfigSelector which determines the ProxyConfig to be used.
    • http1HeaderNaming

      public Http1HeaderNaming http1HeaderNaming()
      Returns the Http1HeaderNaming which converts a lower-cased HTTP/2 header name into another header name. This is useful when communicating with a legacy system that only supports case-sensitive HTTP/1 headers.
    • tlsAllowUnsafeCiphers

      public boolean tlsAllowUnsafeCiphers()
      Returns whether to allow the bad cipher suites listed in RFC7540 for TLS handshake.

      Note that enabling this option increases the security risk of your connection. Use it only when you must communicate with a legacy system that does not support secure cipher suites. See Section 9.2.2, RFC7540 for more information.

    • channelPipelineCustomizer

      @UnstableApi public Consumer<? super io.netty.channel.ChannelPipeline> channelPipelineCustomizer()
      The Consumer that customizes the Netty ChannelPipeline. This customizer is run right before ChannelOutboundInvoker.connect(SocketAddress) is invoked by Armeria. This customizer is no-op by default.

      Note that usage of this customizer is an advanced feature and may produce unintended side effects, including complete breakdown. It is not recommended if you are not familiar with Armeria and Netty internals.