0

I have a kafka topic T.

The user has the option to create new entries A, B, C or delete them. Upon creation of each of the entries A,B or C; I will create a consumer group with the same name for the kafka topic T.

Upon deleting the entries A,B,C; I want to delete the corresponding consumer groups without affecting the topic T by any way - but I want to achieve this from a Java module. How is that possible?

Arijit
  • 420
  • 7
  • 14

2 Answers2

1

Currently, there is only limited Java API for this. There is a discussion in progress to add a Java AdminClient (cf. https://cwiki.apache.org/confluence/display/KAFKA/KIP-117%3A+Add+a+public+AdminClient+API+for+Kafka+admin+operations)

For Zookeeper based consumer groups (ie, old consumer from v0.8) you can have a look into the code of ConsumerGroupCommand -- that's Scala code, but you can still call it from Java.

For broker based consumer groups (ie, new consumer as of v0.9) you cannot delete a consumer group at all (at the moment -- it's WIP to add support for this). However, brokers delete consumer groups automatically if they are not active anymore. You can configure this "delay" via broker setting offsets.retention.minutes (a group is deleted if all of its committed offsets got deleted).

Matthias J. Sax
  • 59,682
  • 7
  • 117
  • 137
-1

I don't have enough points to comment but if your just looking to delete a consumer group the only way to do it is to delete the zookeeper entry /consumers/[group_id]. Here's a link that should point you in the right direction: removing a kafka consumer group in zookeeper

Community
  • 1
  • 1
Carlos Cook
  • 141
  • 3