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

Closed
AhmedNSidd opened this issue Mar 25, 2024 · 3 comments
Labels
stale Issues and pull requests without any recent activity

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.

Copy link

github-actions bot commented Jul 1, 2024

Thank you for taking the time to raise this issue. However, it has not had any activity on it in the past 90 days and will be closed in 30 days if no updates occur.
Please check if the main branch has already resolved the issue since it was raised. If you believe the issue is still valid and you would like input from the maintainers then please comment to ask for it to be reviewed.

@github-actions github-actions bot added the stale Issues and pull requests without any recent activity label Jul 1, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issues and pull requests without any recent activity
Projects
None yet
Development

No branches or pull requests

2 participants