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

Improve consumer group example [documentation] #1336

Closed
curt-hash opened this issue Apr 1, 2019 · 3 comments
Closed

Improve consumer group example [documentation] #1336

curt-hash opened this issue Apr 1, 2019 · 3 comments

Comments

@curt-hash
Copy link

@curt-hash curt-hash commented Apr 1, 2019

Running the existing consumer group example results in a panic. It's pretty clear why, but it might be good to have an example that shows an idiomatic way to cleanly break out of the Consume() loop if the client is closed.

for {
    err := client.Consume(ctx, strings.Split(topics, ","), &consumer)
    if err != nil {
        panic(err)
    }
}
go run main.go -brokers="127.0.0.1:9092" -topics="sarama" -group="example"
2019/04/01 10:47:58 Starting a new Sarama consumer
2019/04/01 10:47:59 Sarama consumer up and running!...
^Cpanic: kafka: tried to use a consumer group that was closed

goroutine 19 [running]:
main.main.func1(0x886cc0, 0xc000116070, 0x887900, 0xc00001e100, 0xc000010060)
	/sarama/examples/consumergroup/main.go:87 +0xeb
@zhaoweiguo
Copy link

@zhaoweiguo zhaoweiguo commented Apr 9, 2019

And it seems like that this command is not work:

config.Consumer.Offsets.Initial = sarama.OffsetNewest

Has anyone encountered the same problem?

@dhbarman
Copy link

@dhbarman dhbarman commented May 22, 2019

Is it possible to enhance the documentation and examples/test cases describing how to handle the following ?

Suppose there is a go-routine A which is invoked (periodically). This go-routine A represents a consumer of a consumer-group. Therefore, A will initiate consume() and that will lead to processing of messages on various claims.

All the messages need to be aggregated at A. One way to achieve this is to create channels. Can we do that without creating channels and communicate between A and ConsumeClaim() methods ?

@probot-shopify
Copy link

@probot-shopify probot-shopify bot commented Feb 21, 2020

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 master 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.

@probot-shopify probot-shopify bot added the stale label Feb 21, 2020
@probot-shopify probot-shopify bot closed this Mar 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.