Interface NettyClientCustomizer

public interface NettyClientCustomizer
Interface implemented by users to hook into the pipeline setup of the netty HTTP client.
The internal pipeline of our HTTP client is by necessity complex and unstable across versions. While we strive to retain compatibility, please do not make too many assumptions about the Micronaut HTTP client pipeline structure when implementing this interface.
Implementations of this interface are scoped to different lifetimes. The root customizers can be added through the NettyClientCustomizer.Registry, and live while the context is running. Customizers with narrower scope are created from the root customizers through specialization when new netty channels are created by the client, e.g. when a new request is made. These specialized customizers will then receive notifications when a certain step in the pipeline setup is reached, so they can do their own customizations on the channel and the channel pipeline they received in the specialization step.
  • Method Details

    • specializeForChannel

      @NonNull default @NonNull NettyClientCustomizer specializeForChannel(@NonNull @NonNull channel, @NonNull @NonNull NettyClientCustomizer.ChannelRole role)
      channel - The new channel to specialize for.
      role - The role (or scope) of the channel.
      The new customizer, or this if no specialization needs to take place.
    • onInitialPipelineBuilt

      default void onInitialPipelineBuilt()
      Called when the initial connection pipeline has been built, before any incoming data has been processed.
    • onStreamPipelineBuilt

      default void onStreamPipelineBuilt()
      Called when the stream pipeline has been built, after any TLS or HTTP upgrade handshake.
    • onRequestPipelineBuilt

      default void onRequestPipelineBuilt()
      Called when the "final" request pipeline has been built for processing http requests. This is called for each request, potentially multiple times for the same connection if the connection is pooled. In the future, for HTTP2, this may use a new channel for each request stream.