Fix batch listener error handling

Updates the batch listener error handler code to handle
the case where there is only a single outstanding
message in the batch list when retries are expired.

Fixes #998

Signed-off-by: darshimo <takumishimoda7623@gmail.com>
This commit is contained in:
darshimo
2025-01-16 16:17:13 +09:00
committed by Chris Bono
parent 4a2c4115f7
commit fddc711730

View File

@@ -781,15 +781,8 @@ public class DefaultPulsarMessageListenerContainer<T> extends AbstractPulsarMess
this.pulsarConsumerErrorHandler.recoverMessage(this.consumer, pulsarMessage,
pulsarBatchListenerFailedException);
handleAck(pulsarMessage, txn);
if (messageList.size() == 1) {
messagesPendingInBatch.set(false);
}
else {
messageList = messageList.subList(1, messageList.size());
}
if (!messageList.isEmpty()) {
messagesPendingInBatch.set(true);
}
messageList.remove(0);
messagesPendingInBatch.set(!messageList.isEmpty());
this.pulsarConsumerErrorHandler.clearMessage();
}
return messageList;