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

kafkabp: Add NewConsumerWithConfigOverriders #639

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

fishy
Copy link
Member

@fishy fishy commented Jan 8, 2024

We occasionally have cases that services need to set some sarama config
that's not supported by kafkabp.ConsumerConfig, and there's currently no
way for them to do that besides forking kafkabp code locally. Provide
this as an escape hatch for easier iteration.

@fishy fishy requested a review from a team as a code owner January 8, 2024 19:09
@fishy fishy requested review from kylelemons, konradreiche and pacejackson and removed request for a team January 8, 2024 19:09
@@ -113,12 +117,16 @@ type consumer struct {
// - If GroupID is empty, it creates a consumer that has the whole view of the
// topic. This implementation of Kafka consumer is suitable for use cases like
// deliver config/data through Kafka to services.
func NewConsumer(cfg ConsumerConfig) (Consumer, error) {
func NewConsumer(cfg ConsumerConfig, opts ...SaramaConfigOverrider) (Consumer, error) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kylelemons technically this is a breaking change, but it should not break users' code in 99% of the cases.

if you want to be strict I can also add a NewConsumerWithOverrider function and keep this one intact.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind added NewConsumerWithConfigOverriders instead. I think that's also easier for us to track how many services are using it.

We occasionally have cases that services need to set some sarama config
that's not supported by kafkabp.ConsumerConfig, and there's currently no
way for them to do that besides forking kafkabp code locally. Provide
this as an escape hatch for easier iteration.
@fishy fishy force-pushed the kafkabp-override-config branch from 4fc3411 to 304ec54 Compare January 8, 2024 19:45
@fishy fishy changed the title kafkabp: Add SaramaConfigOverrider to NewConsumer kafkabp: Add NewConsumerWithConfigOverriders Jan 8, 2024
@fishy fishy merged commit 566aa33 into master Jan 8, 2024
2 checks passed
@fishy fishy deleted the kafkabp-override-config branch January 8, 2024 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants