Skip to content

Commit 98ba703

Browse files
committed
Enhance default methods for backward compatibility (awspring#1251)
1 parent 0c18801 commit 98ba703

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/listener/BackPressureHandler.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ public interface BackPressureHandler {
5555
* @param amount the amount of permits to release.
5656
* @param reason the reason why the permits were released.
5757
*/
58-
void release(int amount, ReleaseReason reason);
58+
default void release(int amount, ReleaseReason reason) {
59+
release(amount);
60+
}
5961

6062
/**
6163
* Release the specified amount of permits. Each message that has been processed should release one permit, whether
@@ -67,6 +69,7 @@ public interface BackPressureHandler {
6769
*/
6870
@Deprecated
6971
default void release(int amount) {
72+
release(amount, ReleaseReason.PROCESSED);
7073
}
7174

7275
/**

spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/listener/BatchAwareBackPressureHandler.java

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public interface BatchAwareBackPressureHandler extends BackPressureHandler {
4141
*/
4242
@Deprecated
4343
default void releaseBatch() {
44+
release(getBatchSize(), ReleaseReason.NONE_FETCHED);
4445
}
4546

4647
/**

0 commit comments

Comments
 (0)