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_r341918259
##########
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:
The go client produces messages in a batch format. Each message in that
batch needs to be acked before sending the ack to the broker. This seemed like
the logical place to put it since acks are based on a message id and it's
similar to the java client BatchMessageIdImpl. It's an internal class too so
it's not exported and can be changed later without effecting clients or apis. I
think this approach makes the code easier to reason about since everything is
treated as a batch message. If the messageId.ack() returns true we can send the
ack to the broker. The other option is to maintain the state in a consumer and
I think that complicates the code. Thoughts?
----------------------------------------------------------------
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