Skip to content

Commit c3cc65d

Browse files
authored
GH-3079: Allow ACKs within the ShutdownTimeout period
Fixes: #3079 Issue link: #3079 Remove `cancelled()` condition from the `BlockingQueueConsumer.commitIfNecessary()` to allow initiated acks to be committed. The cancelled consumer means no new deliveries, but that does not mean we cannot ack outstanding messages. Actually, this is a leftover after previous fix with assumption that messages have to be returned to the queue with `Recovery` command when consumer is cancelled. Signed-off-by: Marco Cozzi <[email protected]> **Auto-cherry-pick to `3.2.x` & `3.1.x`**
1 parent 87d4d75 commit c3cc65d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/BlockingQueueConsumer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ public void rollbackOnExceptionIfNecessary(Throwable ex, long tag) {
888888

889889
/**
890890
* Perform a commit or message acknowledgement, as appropriate.
891-
* NOTE: This method was never been intended tobe public.
891+
* NOTE: This method was never intended to be public.
892892
* @param localTx Whether the channel is locally transacted.
893893
* @param forceAck perform {@link Channel#basicAck(long, boolean)} independently of {@link #acknowledgeMode}.
894894
* @return true if at least one delivery tag exists.
@@ -909,7 +909,7 @@ boolean commitIfNecessary(boolean localTx, boolean forceAck) {
909909
try {
910910
boolean ackRequired = forceAck || (!this.acknowledgeMode.isAutoAck() && !this.acknowledgeMode.isManual());
911911

912-
if (ackRequired && (!this.transactional || (isLocallyTransacted && !cancelled()))) {
912+
if (ackRequired && (!this.transactional || isLocallyTransacted)) {
913913
OptionalLong deliveryTag = this.deliveryTags.stream().mapToLong(l -> l).max();
914914
deliveryTag.ifPresent((tag) -> {
915915
try {

0 commit comments

Comments
 (0)