cckellogg commented on a change in pull request #82: Added a message id tracker 
for acking messages that are batched.
URL: https://github.com/apache/pulsar-client-go/pull/82#discussion_r342384600
 
 

 ##########
 File path: pulsar/impl_message.go
 ##########
 @@ -18,30 +18,31 @@
 package pulsar
 
 import (
+       "math/big"
+       "strings"
+       "sync"
        "time"
 
-       "github.com/apache/pulsar-client-go/pkg/pb"
        "github.com/golang/protobuf/proto"
-)
 
-func earliestMessageID() MessageID {
-       return newMessageID(-1, -1, -1, -1)
-}
+       "github.com/apache/pulsar-client-go/pkg/pb"
+)
 
 type messageID struct {
        ledgerID     int64
        entryID      int64
        batchIdx     int
        partitionIdx int
+
+       tracker *ackTracker
 
 Review comment:
   To me it looks like this design will cause us always have to check for two 
different message ids types and then handle them in a different way. Is that 
correct?
   
   ```
   switch v := i.(type) {
   case *messageID:
        // handle non batch
   case *msgTracker:
          // handle batch
   ```
   
   @wolfstudy how do you see your suggested design working when the client 
sends back a MessageID interface that we need to ack?
   
   The general goal of this patch was to make ack checking in the code simple 
whether the message was batched or not
   ```
   func (c *consumer) Ack(msgID MessageID) error {
     if msgID.(*messageID).ack() {
       // message id can be acked send to server
     }
   }
   ```
   
   
   
   
   
   

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

Reply via email to