Skip to content

Commit 5d99834

Browse files
marcogramyspring-builds
authored andcommitted
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]> (cherry picked from commit c3cc65d)
1 parent f4db402 commit 5d99834

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
@@ -884,7 +884,7 @@ public void rollbackOnExceptionIfNecessary(Throwable ex, long tag) {
884884

885885
/**
886886
* Perform a commit or message acknowledgement, as appropriate.
887-
* NOTE: This method was never been intended tobe public.
887+
* NOTE: This method was never intended to be public.
888888
* @param localTx Whether the channel is locally transacted.
889889
* @return true if at least one delivery tag exists.
890890
* @deprecated in favor of {@link #commitIfNecessary(boolean, boolean)}
@@ -917,7 +917,7 @@ boolean commitIfNecessary(boolean localTx, boolean forceAck) {
917917
try {
918918
boolean ackRequired = forceAck || (!this.acknowledgeMode.isAutoAck() && !this.acknowledgeMode.isManual());
919919

920-
if (ackRequired && (!this.transactional || (isLocallyTransacted && !cancelled()))) {
920+
if (ackRequired && (!this.transactional || isLocallyTransacted)) {
921921
OptionalLong deliveryTag = this.deliveryTags.stream().mapToLong(l -> l).max();
922922
deliveryTag.ifPresent((tag) -> {
923923
try {

0 commit comments

Comments
 (0)