BewareMyPower commented on code in PR #1301:
URL: https://github.com/apache/pulsar-client-go/pull/1301#discussion_r1825525233
##########
pulsar/consumer.go:
##########
@@ -307,6 +307,14 @@ type Consumer interface {
// AckID the consumption of a single message, identified by its
MessageID
AckID(MessageID) error
+ // AckIDList the consumption of a list of messages, identified by their
MessageIDs
+ // Returns a map of MessageID to error, the keys are the MessageIDs
that failed to be acknowledged
+ // NOTE: When EnableBatchIndexAcknowledgment is false, if a message ID
represents a message in the batch,
+ // it will not be actually acknowledged by broker until all messages in
that batch are acknowledged via
+ // the AckID or AckIDList method.
+ // However, in this case, no error will be returned for that message ID
even if AckWithResponse is true.
+ AckIDList([]MessageID) map[MessageID]error
Review Comment:
@nodece I just had a quick sync with @RobertIndie
With the current implementation, the only case that only partial of the
message ID list failed is: there are some invalid message IDs.
Therefore, we can just return a trivial `error` to tell users that all these
message ID failed.
```golang
if err := consumer.AckIDList(ids); err != nil {
if errorMap, ok := err.(AckIDListError); ok {
for msgID, err := range errorMap {
// Add msgID to the message ID list to retry
}
} else {
// Add the whole ids to the message ID list to retry
}
}
```
WDYT?
--
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]