codelipenghui 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_r340938778
##########
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:
If users use the external sequence id and enable batch on producer, sequence
id 1,2,3,1 will happens if we do not the check, we can just throw an exception
when using the external sequence id?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services