Skip to content

Commit fddc711

Browse files
darshimoonobc
authored andcommitted
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 <[email protected]>
1 parent 4a2c411 commit fddc711

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

spring-pulsar/src/main/java/org/springframework/pulsar/listener/DefaultPulsarMessageListenerContainer.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -781,15 +781,8 @@ private List<Message<T>> invokeBatchListenerErrorHandler(AtomicBoolean inRetryMo
781781
this.pulsarConsumerErrorHandler.recoverMessage(this.consumer, pulsarMessage,
782782
pulsarBatchListenerFailedException);
783783
handleAck(pulsarMessage, txn);
784-
if (messageList.size() == 1) {
785-
messagesPendingInBatch.set(false);
786-
}
787-
else {
788-
messageList = messageList.subList(1, messageList.size());
789-
}
790-
if (!messageList.isEmpty()) {
791-
messagesPendingInBatch.set(true);
792-
}
784+
messageList.remove(0);
785+
messagesPendingInBatch.set(!messageList.isEmpty());
793786
this.pulsarConsumerErrorHandler.clearMessage();
794787
}
795788
return messageList;

0 commit comments

Comments
 (0)