Skip to content

Commit 498d4f9

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 233a43e commit 498d4f9

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

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

907-
if (ackRequired && (!this.transactional || (isLocallyTransacted && !cancelled()))) {
907+
if (ackRequired && (!this.transactional || isLocallyTransacted)) {
908908
OptionalLong deliveryTag = this.deliveryTags.stream().mapToLong(l -> l).max();
909909
deliveryTag.ifPresent((tag) -> {
910910
try {

0 commit comments

Comments
 (0)