Closed dgqypl closed 5 months ago
妥,最近处理下。
Mew151 @.***> 于2024年5月10日周五 17:12写道:
现在默认是异步写,如果写失败了,应用程序没办法感知到错误,无法对错误做后续处理。
相关代码:
创建 Producer:
底层 kafka-go 的回调方法:
— Reply to this email directly, view it on GitHub https://github.com/tx7do/kratos-transport/issues/81, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADZKQJCQA3CBVSGYLYYCP3DZBSFQZAVCNFSM6AAAAABHQI4HFCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI4DSMZTGUZTKNI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
现在默认是异步写,如果写失败了,应用程序没办法感知到错误,无法对错误做后续处理。
相关代码:
默认是异步写:
https://github.com/tx7do/kratos-transport/blob/5abe8d6a8931bd6f3e6298fea446553852b12f36/broker/kafka/kafka.go#L65
创建 Producer: https://github.com/tx7do/kratos-transport/blob/5abe8d6a8931bd6f3e6298fea446553852b12f36/broker/kafka/writer.go#L112-L128
底层 kafka-go 的回调函数:
https://github.com/segmentio/kafka-go/blob/ebca72eaee918d303c532feb7ff29afdcd8c2efa/writer.go#L161-L182