Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error not being thrown when multiple consumer groups are created with the same group ID #2842

Open
AhmedNSidd opened this issue Mar 25, 2024 · 2 comments

Comments

@AhmedNSidd
Copy link

Description

The issue is simple:

consumerGroup1, err := sarama.NewConsumerGroup(same_kafka_broker, "groupId", sarama.NewConfig())
consumerGroup2, err := sarama.NewConsumerGroup(same_kafka_broker, "groupId", sarama.NewConfig())

The above code should given an error because you're not supposed to be able to create two consumer groups with the same group ID, but you're able to do so here.

Additional context

N/A

@dnwe
Copy link
Collaborator

dnwe commented Mar 27, 2024

👋🏻 hi and thanks for raising this question

The above code should given an error because you're not supposed to be able to create two consumer groups with the same group ID, but you're able to do so here

Why would it not be allowed? A consumer group is intended to contain more than one consumer. Whilst unusual, if you use the same groupId for two sarama.NewConsumerGroup(...) calls within the same Go process, it is really no different functionally to you running two separate Go processes that both join the same group. You'll just have two members within your single process, with different partition assignments within the same group.

@AhmedNSidd
Copy link
Author

Why would it not be allowed? A consumer group is intended to contain more than one consumer. Whilst unusual, if you use the same groupId for two sarama.NewConsumerGroup(...) calls within the same Go process, it is really no different functionally to you running two separate Go processes that both join the same group. You'll just have two members within your single process, with different partition assignments within the same group.

Alright, fair enough. It just wasn't something that was clear to me from looking at the function's signature / documentation because as far as I know in Kafka, if you try to create a new consumer group with the same group ID as one that already exists, you can't generally do that. What you're referring to seems to be adding new consumers to the existing consumer group (I could be wrong, I'm still learning Kafka).

Anyway, I think we can close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants