Interface BackPressureHandlerFactory

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface BackPressureHandlerFactory
Factory interface for creating BackPressureHandler instances to manage queue consumption backpressure.

Implementations of this interface are responsible for producing a new BackPressureHandler for each container, configured according to the provided ContainerOptions. This ensures that internal resources (such as counters or semaphores) are not shared across containers, which could lead to unintended side effects.

Default factory implementations can be found in the BackPressureHandlerFactories class.

Author:
Loïc Rouchon, Tomaz Fernandes
See Also:
  • Method Details

    • createBackPressureHandler

      BackPressureHandler createBackPressureHandler(ContainerOptions<?,?> containerOptions)
      Creates a new BackPressureHandler instance based on the provided ContainerOptions.

      NOTE: it is important for the factory to always return a new instance as otherwise it might result in a BackPressureHandler internal resources (counters, semaphores, ...) to be shared by multiple containers, unless that's the desired behavior.

      Parameters:
      containerOptions - the container options to use for creating the BackPressureHandler.
      Returns:
      the created BackPressureHandler