merlimat commented on a change in pull request #5491: Fix message deduplicate issue while using external sequence id with batch produce URL: https://github.com/apache/pulsar/pull/5491#discussion_r340896656
########## File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java ########## @@ -368,6 +372,19 @@ public void sendAsync(Message<T> message, SendCallback callback) { } else { sequenceId = msgMetadataBuilder.getSequenceId(); } + + if (sequenceId <= lastSequenceIdPushed) { + if (sequenceId <= lastSequenceIdPublished) { + callback.sendComplete(new PulsarClientException + .InvalidMessageException("Message is definitely a duplicate")); Review comment: We shouldn't trigger an error to the application when there are dups, rather the contract is that it gets an OK. In any case we need to think through the implication of triggering an error just for one message out of band. This is a very different behavior from the other failure modes where all the messages are failed after 1 failure. I believe that handling this in broker side is much preferable. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services