You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/main/asciidoc/sqs.adoc
+12-13Lines changed: 12 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1989,8 +1989,9 @@ NOTE: The `AUTO` setting should be balanced for most use cases, including high t
1989
1989
1990
1990
==== Advanced Backpressure management
1991
1991
1992
+
Since 4.0.0, the default `BackPressureHandler` is assembled based on `ContainerOptions#BackPressureMode`, using a `CompositeBackPressureHandler` to combine multiple handlers that together replicate the behavior of the original `SemaphoreBackPressureHandler`.
1992
1993
Even though the default `BackPressureHandler` should be enough for most use cases, there are scenarios where more fine-grained control over message consumption is required not to overwhelm downstream systems or exceed resource limits.
1993
-
In such a case, it is necessary to replace the default `BackPressureHandler` with a custom one that implements the `BackPressureHandler` interface.
1994
+
In such a case, it is possible to replace the default `BackPressureHandler` with a custom one that implements the `BackPressureHandler` interface.
1994
1995
A `backPressureHandlerFactory` can be set in `SqsContainerOptions` to configure which `BackPressureHandler` to use.
If necessary, multiple `BackPressureHandler` can be combined by using the `CompositeBackPressureHandler`.
2020
-
Each of the `BackPressureHandler` (which we'll call delegates) are chained in the order they are provided.
2021
+
Each of the `BackPressureHandler` delegates are chained in the order they are provided.
2021
2022
The first delegate will be requested the initial amount of permits and will return the number of permits it accepts to grant.
2022
2023
The second delegate will get that potentially reduced number of permits as a request and might in turn reduce it further.
2023
-
The process continues until all delegates have been called or one of them returns 0, which will prevent the polling of messages from SQS.
2024
+
The process continues until all delegates have been called or one of them returns 0, which will prevent the polling of messages from SQS for that round of permit requests.
2024
2025
2025
2026
For example, to implement the `BackPressureMode.ALWAYS_POLL_MAX_MESSAGES` strategy, we can combine a concurrency limiter, an adaptative throughput handler, and a "full batch only" handler.
2026
-
The resulting `CompositeBackPressureHandler` looks like this:
2027
+
The `BackPressureHandlerFactory` to create such a `CompositeBackPressureHandler` is assembled as follows:
Spring Cloud AWS provides several built-in `BackPressureHandler` implementations:
2040
+
Spring Cloud AWS provides the following built-in `BackPressureHandler` implementations:
2042
2041
2043
2042
- `ConcurrencyLimiterBackPressureHandler`: Limits the number of messages being processed concurrently.
2044
2043
- `ThroughputBackPressureHandler`: Switches between high and low throughput modes. In high throughput mode, multiple polls can be done in parallel.
@@ -2049,7 +2048,7 @@ This `FullBatchBackPressureHandler` must always be the last in the chain for it
2049
2048
The `BackPressureHandlerFactories` class provides factory methods to create these handlers easily.
2050
2049
These handlers can be used directly or combined with custom ones using the `CompositeBackPressureHandler` to fit the application's needs.
2051
2050
2052
-
Additionally, the `BackPressureHandlerFactories#adaptativeThroughputBackPressureHandler` factory method combines the `ConcurrencyLimiterBackPressureHandler`, `ThroughputBackPressureHandler`, and `FullBatchBackPressureHandler` as per the desired `BackPressureMode`.
2051
+
Additionally, the `BackPressureHandlerFactories#adaptiveThroughputBackPressureHandler` factory method combines the `ConcurrencyLimiterBackPressureHandler`, `ThroughputBackPressureHandler`, and `FullBatchBackPressureHandler` as per the desired `BackPressureMode`.
Copy file name to clipboardExpand all lines: spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/listener/AbstractPipelineMessageListenerContainer.java
0 commit comments