BewareMyPower commented on code in PR #1301:
URL: https://github.com/apache/pulsar-client-go/pull/1301#discussion_r1828688076


##########
pulsar/consumer_multitopic.go:
##########
@@ -167,6 +167,47 @@ func (c *multiTopicConsumer) AckID(msgID MessageID) error {
        return mid.consumer.AckID(msgID)
 }
 
+func (c *multiTopicConsumer) AckIDList(msgIDs []MessageID) error {
+       return ackIDListFromMultiTopics(c.log, msgIDs, func(msgID MessageID) 
(acker, error) {
+               if !checkMessageIDType(msgID) {
+                       return nil, errors.New("invalid message id type %T")
+               }
+               if mid := toTrackingMessageID(msgID); mid != nil && 
mid.consumer != nil {
+                       return mid.consumer, nil
+               }
+               return nil, errors.New("consumer is nil")
+       })
+}
+
+func ackIDListFromMultiTopics(log log.Logger, msgIDs []MessageID, findConsumer 
func(MessageID) (acker, error)) error {
+       consumerToMsgIDs := make(map[acker][]MessageID)
+       for _, msgID := range msgIDs {
+               if consumer, err := findConsumer(msgID); err == nil {
+                       consumerToMsgIDs[consumer] = 
append(consumerToMsgIDs[consumer], msgID)
+               } else {
+                       log.Warnf("Can not find consumer for %v", msgID)

Review Comment:
   But users can do nothing to handle invalid message IDs except for excluding 
them from the next `AckIDList` call.
   
   It will make users hard to handle the error.



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