Class ThroughputBackPressureHandler

java.lang.Object
io.awspring.cloud.sqs.listener.backpressure.ThroughputBackPressureHandler
All Implemented Interfaces:
BackPressureHandler, IdentifiableContainerComponent

public class ThroughputBackPressureHandler extends Object implements BackPressureHandler, IdentifiableContainerComponent
A non-blocking BackPressureHandler that dynamically switches between high- and low-throughput modes to optimize polling behavior based on recent message availability.

Throughput modes

  • Low-throughput mode: Only a single batch may be requested at a time. If a batch is already in-flight, zero permits are granted.
  • High-throughput mode: Multiple batches may be requested concurrently. All requested permits are granted.

Throughput mode switching: The handler starts in low-throughput mode. It switches to high-throughput mode if messages are returned from a poll, and reverts to low-throughput mode if no messages are returned.

Typically used in conjunction with a concurrency-limiting BackPressureHandler such as ConcurrencyLimiterBlockingBackPressureHandler.

This handler builds on the original SemaphoreBackPressureHandler, separating specific responsibilities into a more modular form and enabling composition with other handlers as part of an extensible backpressure strategy.

Since:
4.0.0
Author:
Loïc Rouchon, Tomaz Fernandes
See Also: