File tree Expand file tree Collapse file tree 2 files changed +17
-16
lines changed Expand file tree Collapse file tree 2 files changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -102,10 +102,17 @@ class CPPKAFKA_API PollStrategyBase : public PollInterface {
102102 * belonging to the provided partition list and calls reset_state().
103103 * To be used with static consumers.
104104 *
105- * \param partitions Revoked topic partitions. If the partition list is empty
106- * all partitions will be revoked.
105+ * \param partitions Revoked topic partitions.
107106 */
108- virtual void revoke (const TopicPartitionList& partitions = {});
107+ virtual void revoke (const TopicPartitionList& partitions);
108+
109+ /* *
110+ * \brief Removes all partitions queues associated with the supplied partitions.
111+ *
112+ * This method contains a default implementation. It removes all the queues
113+ * currently assigned and calls reset_state(). To be used with static consumers.
114+ */
115+ virtual void revoke ();
109116
110117protected:
111118 /* *
Original file line number Diff line number Diff line change @@ -99,23 +99,17 @@ void PollStrategyBase::assign(TopicPartitionList& partitions) {
9999}
100100
101101void PollStrategyBase::revoke (const TopicPartitionList& partitions) {
102- if (partitions.empty ()) {
103- // revoke everything
104- partition_queues_.clear ();
105- }
106- else {
107- for (const auto &partition : partitions) {
108- // get the queue associated with this partition
109- auto toppar_it = partition_queues_.find (partition);
110- if (toppar_it != partition_queues_.end ()) {
111- // remove this queue from the list
112- partition_queues_.erase (toppar_it);
113- }
114- }
102+ for (const auto &partition : partitions) {
103+ partition_queues_.erase (partition);
115104 }
116105 reset_state ();
117106}
118107
108+ void PollStrategyBase::revoke () {
109+ partition_queues_.clear ();
110+ reset_state ();
111+ }
112+
119113void PollStrategyBase::on_assignment (TopicPartitionList& partitions) {
120114 assign (partitions);
121115 // call original consumer callback if any
You can’t perform that action at this time.
0 commit comments