[feat][pulsar-client-api] support to Cumulative Acknowledge for multiple partitions or topics in user friendly manner
Fixes #17574
Master Issue: #17574
Motivation
Email from Yunze Xu
Assuming users called "acknowledgeCumulative" periodically, there is a chance that some messages of the specific partition has never been passed to the method. For example, a consumer received: P0-M0, P1-M0, P0-M1, P1-M1, P0-M2, P1-M2... And the user acknowledged every two messages, i.e. P0-M0, P0-M1, P0-M2. Eventually, partition 1 has never been acknowledged. User must maintain its own `Map<String, MessageId>> cache for a partitioned topic or multi-topics consumer with the existing "acknowledgeCumulative" API.
Should we make it more friendly for users? For example, we can make "acknowledgeCumulative" accept the map to remind users to maintain the map from topic name to message ID: java
// the key is the partitioned topic name like my-topic-partition-0 void acknowledgeCumulative(Map<String, MessageId> topicToMessageId);
Modifications
add support for acknowledgeCumulative(Map<String, MessageId> topicToMessageId)
Verifying this change
This change added tests and can be verified as follows:: org/apache/pulsar/client/api/ConsumerCumulativeAckMapTest.java
Documentation
- [ ]
doc-not-needed
@tarunannapareddy Please provide a correct documentation label for your PR. Instructions see Pulsar Documentation Label Guide.
The pr had no activity for 30 days, mark with Stale label.