Skip to content

Commit

Permalink
Allow removeMembersFromConsumerGroup without members (#1227)
Browse files Browse the repository at this point in the history
In the Kafka Admin API, it's possible to call
`removeMembersFromConsumerGroup` without passing any member. This is
different from passing an empty `Set()` which is failing the validation
of `RemoveMembersFromConsumerGroupOptions`.
  • Loading branch information
sderosiaux authored Apr 21, 2024
1 parent 40f4b01 commit f7e6d25
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions zio-kafka/src/main/scala/zio/kafka/admin/AdminClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ trait AdminClient {
*/
def removeMembersFromConsumerGroup(groupId: String, membersToRemove: Set[String]): Task[Unit]

/**
* Remove all members from a consumer group.
*/
def removeMembersFromConsumerGroup(groupId: String): Task[Unit]

/**
* Describe the log directories of the specified brokers
*/
Expand Down Expand Up @@ -756,6 +761,18 @@ object AdminClient {
).unit
}

/**
* Remove all members from a consumer group.
*/
override def removeMembersFromConsumerGroup(groupId: String): Task[Unit] = {
val options = new RemoveMembersFromConsumerGroupOptions()
fromKafkaFuture(
ZIO.attemptBlocking(
adminClient.removeMembersFromConsumerGroup(groupId, options).all()
)
).unit
}

override def describeLogDirs(
brokersId: Iterable[Int]
): ZIO[Any, Throwable, Map[Int, Map[String, LogDirDescription]]] =
Expand Down

0 comments on commit f7e6d25

Please sign in to comment.