BewareMyPower commented on code in PR #18405:
URL: https://github.com/apache/pulsar/pull/18405#discussion_r1021031933


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessageIdImpl.java:
##########
@@ -155,8 +155,14 @@ public static MessageId fromByteArrayWithTopic(byte[] 
data, TopicName topicName)
 
         MessageId messageId;
         if (idData.hasBatchIndex()) {
-            messageId = new BatchMessageIdImpl(idData.getLedgerId(), 
idData.getEntryId(), idData.getPartition(),
-                idData.getBatchIndex(), idData.getBatchSize(), 
BatchMessageAcker.newAcker(idData.getBatchSize()));
+            if (idData.hasBatchSize()) {

Review Comment:
   I would like to refactor these two classes in another PR. IMO, 
BatchMessageIdImpl should be deprecated and I'm not willing to add new public 
APIs to it. The design of BatchMessageIdImpl is bad. We should add the optional 
`batch_size` and `batch_index` fields to MessageIdImpl instead. If we followed 
the design of BatchMessageIdImpl, when `batch_size` was introduced, we should 
add another class like BatchMessageIdImplWithSize that inherits the 
BatchMessageIdImpl and add the `batch_size` field as well as the acker.



-- 
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]

Reply via email to