315157973 commented on code in PR #19874:
URL: https://github.com/apache/pulsar/pull/19874#discussion_r1144357194
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java:
##########
@@ -496,8 +496,13 @@ protected CompletableFuture<Void>
doAcknowledge(List<MessageId> messageIdList,
}
topicToMessageIdMap.forEach((topicPartitionName, messageIds) -> {
ConsumerImpl<T> consumer = consumers.get(topicPartitionName);
- resultFutures.add(consumer.doAcknowledgeWithTxn(messageIds,
ackType, properties, txn)
- .thenAccept((res) ->
messageIdList.forEach(unAckedMessageTracker::remove)));
+ if (consumer != null) {
+
resultFutures.add(consumer.doAcknowledgeWithTxn(messageIds, ackType,
properties, txn)
+ .thenAccept((res) ->
messageIdList.forEach(unAckedMessageTracker::remove)));
+ } else {
+ log.warn("MessageIds whose owner topic is {} will be
discard because the consumer is not connected",
Review Comment:
You cannot control how users use your interface.
We should do interface constraints, not verbal, document, or expect
customers can use correctly.
If the interface does not report an exception, it means that it executed
successfully, but in fact it is not successful, and the message cannot be
cleared. Isn't this a bug?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]