-
Notifications
You must be signed in to change notification settings - Fork 33
Update kafka.go #56
base: master
Are you sure you want to change the base?
Update kafka.go #56
Conversation
kafkaReport组件bug修复
You need to update the PR title and codes/comments in English, also, you should describe the bug the PR content. |
The current bug is an kafka connection, and you can only report data once, because there is no processing of the return message of data reporting. |
kafkareporter/kafka.go
Outdated
@@ -297,6 +297,17 @@ func (r *kafkaReporter) Close() { | |||
r.logger.Print(err) | |||
} | |||
} | |||
//循环处理上报信息的结果信息,以实现kafka单次连接多次上报。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment should be updated as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
@arugal Could you recheck on Kafka API? |
select { | ||
case <-r.producer.Successes(): | ||
case err := <- r.producer.Errors(): | ||
r.logger.Fatalf( "kafkaReport readBackMessage error detail is %s",err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using the log.Errorf
output will do, which will cause the process to end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can check the revised document to confirm. github.com/Shopify/sarama/async_producer.go
// Successes is the success output channel back to the user when Return.Successes is
// enabled. If Return.Successes is true, you MUST read from this channel or the
// Producer will deadlock. It is suggested that you send and read messages
// together in a single select statement.
Successes() <-chan *ProducerMessage
// Errors is the error output channel back to the user. You MUST read from this
// channel or the Producer will deadlock when the channel is full. Alternatively,
// you can set Producer.Return.Errors in your config to false, which prevents
// errors to be returned.
Errors() <-chan *ProducerError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/golang/go/blob/go1.16.15/src/log/log.go#L209-L212
@liufugen-yewu The process will exit after Fatalf
KafkaReport component bug repair