shibd commented on code in PR #1301:
URL: https://github.com/apache/pulsar-client-go/pull/1301#discussion_r1829073844
##########
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:
Ok, Make sense to me. The user can from warn log to get this.
--
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]