You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// consumerGroupHandler.ConsumeClaim() is called for every topic partitiontypeconsumerGroupHandlerstruct {
ctx context.Context
}
func (c*consumerGroupHandler) ConsumeClaim(session sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error {
// use c.ctx
}
At present ConsumeClaim function does not accept context. So the context needs to be kept in struct consumerGroupHandler.
Support for ConsumeClaimWithContext() would help.
Golang still recommends passing context to every function. golang/go#22602
Do not store Contexts inside a struct type; instead, pass a Context explicitly to each function that needs it. The Context should be the first parameter, typically named ctx
The text was updated successfully, but these errors were encountered:
I replied about Session having a Context() but I read through your other thread and it seems you know that.
I think I disagree with ConsumeClaimWithContext as it obscures the fact that Context is available with ConsumeClaim. You can always introduce your own method:
Problem Description
At present
ConsumeClaim
function does not accept context. So the context needs to be kept in structconsumerGroupHandler
.Support for
ConsumeClaimWithContext()
would help.Golang still recommends passing context to every function. golang/go#22602
The text was updated successfully, but these errors were encountered: