Commit 7bc2b88
fix(core): correct retry semantics for consumer maxAttempts configuration
The retry policy previously used maxRetries(properties.getMaxAttempts()), which caused an off-by-one error because maxRetries represents the number of retries while maxAttempts represents total delivery attempts.
Example:
maxAttempts=2 resulted in 3 executions (1 initial + 2 retries).
This change converts maxAttempts to retries by using:
maxRetries = maxAttempts - 1
A test (MaxAttemptsRetryTests) has been added to reproduce and verify the correct behavior.
Signed-off-by: vishwasio <[email protected]>1 parent f2b6af6 commit 7bc2b88
File tree
2 files changed
+50
-1
lines changed- core/spring-cloud-stream/src
- main/java/org/springframework/cloud/stream/binder
- test/java/org/springframework/cloud/stream/binder
2 files changed
+50
-1
lines changedcore/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractBinder.java
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
| 212 | + | |
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| |||
Lines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
0 commit comments