DWQA QuestionsCategory: Artificial IntelligenceAbout the processing scheme after Kafka retry times
WillLiaowh asked 3 months ago

As for Kafka’s retry mechanism, I know that when the producer sends a message to the broker, there is the attribute retries, which represents the number of retries the producer sends a message when an exception occurs. If the number of retries is reached, the producer will give up the retry and return an exception. How should the message or exception be handled later at this time?
In addition, do consumers also have a retry mechanism? For example, when consumers consume messages, will they try again if there are exceptions?,I have already answered you once. When the number of retries exceeds the preset threshold, how to deal with it is up to youYour own business scenario。 Common practices include

  • Continue to retry until the end of time. If the network cable is broken, this method is very inefficient.
  • If the business is not sensitive to the lost message, it can discard the information directly
  • If the service is sensitive to message loss, the error can be recorded, and then the alarm can be sent for manual intervention

In short, how to deal with it is up to your business, and so are consumers.

1 Answers
youth7 answered 3 months ago

I have already answered you once. When the number of retries exceeds the preset threshold, how to deal with it is up to youYour own business scenario。 Common practices include

  • Continue to retry until the end of time. If the network cable is broken, this method is very inefficient.
  • If the business is not sensitive to the lost message, it can discard the information directly
  • If the service is sensitive to message loss, the error can be recorded, and then the alarm can be sent for manual intervention

In short, how to deal with it is up to your business, and so are consumers.

WillLiaowh replied 3 months ago

What is the way to record the errors?

youth7 replied 3 months ago

@WillLiaowhWrite a log and persist it in the way you want, such as saving files, saving databases, sending to es, etc