Thanks for your answer, I set a large min.insync.replicas for the topic and I can see in the console log that Kafka Sender keeps retrying.
Haruki Okada <ocadar...@gmail.com> 于2023年11月13日周一 16:50写道: > > > will the callback be executed for each retry > > The callback will be triggered only once when the produce is finally ended > up with succeeded or failed after retries. > > > is there any way to make Kafka producers retry locally > > Easiest way would be to make produce failing artificially. it can be done > by e.g.: > - set acks=all and set topic's min.insync.replicas to impossibly large value > - use iptables between producer and broker to block the network connectivity > > 2023年11月12日(日) 18:10 王有胜 <wonderfulserendipi...@gmail.com>: > > > Hi Community, I use Kafka Java Client to send messages asynchronously. > > I wonder if the producer fails to send a message, during the retry > > period, will the callback be executed for each retry? > > I debugged the source code > > org.apache.kafka.clients.producer.internals.Sender#canRetry and > > org.apache.kafka.clients.producer.internals.Sender#reenqueueBatch > > parts, and I'm still not sure. > > Can anyone help answer this question? > > In addition, is there any way to make Kafka producers retry locally? I > > want to completely understand the code logic. > > Thanks! > > > > > -- > ======================== > Okada Haruki > ocadar...@gmail.com > ========================