confluentinc / confluent-kafka-python

Confluent's Kafka Python Client
http://docs.confluent.io/current/clients/confluent-kafka-python
Other
130 stars 897 forks source link

Retriable Error: Which errors are retriable? #1804

Closed Nabil-Miri closed 2 months ago

Nabil-Miri commented 2 months ago

Description

I am using an error_cb for the producer and I want that when I get an error, the producer retry sending a message but nothing is printing . Code: def error_cb(e): """ Callback function to handle producer errors. """ print(f"Producer error: {e}") if e.retriable(): print("retry") retry text is not getting printed. Only the Error. I tried different types of errors but none triggered it.

How to reproduce

Checklist

Please provide the following information:

pranavrth commented 2 months ago

The flags are set for some of the errors (mainly errors related to transactional producer) which are retriable, abortable or fatal. These flags were introduced for the transactional producers. These flags are not set for normal producer in general.

Also, not all the errors can have these flags and its not always obvious if a error is retriable or not. It depends on the context.

Nabil-Miri commented 2 months ago

Oh ok. Then, it's not for every error. I thought that I can implement it in a way, when an error happens, a retry of the step that caused the error could happen again. Thanks a lott for your comment!