Skip to content

Issue with consumer group example #3023

Open
@zzhangsg

Description

Description

Context
From the example provided in this repository, a single consumer is created within the consumer group to process messages, and it gets assigned to all partitions of a Kafka topic. However, Kafka's design encourages leveraging partitioning to enable parallelism, which seems to favor multiple consumers within the same group for optimal resource utilization.

To align with Kafka's design and achieve partition-level parallelism, we are exploring a setup where N consumers are initialized within the same consumer group. This involves creating N clients and passing them to the NewConsumerGroupFromClient function with the same consumer group ID so that each consumer gets one partition.

Questions

  1. Is this model valid?
  • Can we create multiple consumers within the same group by initializing multiple clients and assigning them to the same consumer group ID?
  1. Rebalancing and Partition Assignment:
  • How does the partition rebalancing handling work when using this model?
  • If the number of partitions increases or decreases, how are the changes reflected across the multiple consumers within the group?
Versions
Sarama Kafka Go
Configuration
Logs
logs: CLICK ME


Additional Context

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions