fix(kafka): ConsumeClaim should return when messages channel closed (#2120)

Signed-off-by: cong <zhangcong1992@gmail.com>

Signed-off-by: cong <zhangcong1992@gmail.com>
This commit is contained in:
cong 2022-09-24 00:54:59 +08:00 committed by GitHub
parent ac87ed4e9d
commit 1a7882fca5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -38,7 +38,11 @@ func (consumer *consumer) ConsumeClaim(session sarama.ConsumerGroupSession, clai
for {
select {
case message := <-claim.Messages():
case message, ok := <-claim.Messages():
if !ok {
return nil
}
if consumer.k.consumeRetryEnabled {
if err := retry.NotifyRecover(func() error {
return consumer.doCallback(session, message)