Re: About Kafka Java Client Producer Retry And Callback

2023-11-15 Thread 1
退订




On 11/14/2023 18:19,王有胜 wrote:
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  于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 王有胜 :

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



Re: About Kafka Java Client Producer Retry And Callback

2023-11-14 Thread 王有胜
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  于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 王有胜 :
>
> > 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
> 


Re: About Kafka Java Client Producer Retry And Callback

2023-11-13 Thread Haruki Okada
> 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 王有胜 :

> 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



About Kafka Java Client Producer Retry And Callback

2023-11-12 Thread 王有胜
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!