Kafka messages are consumed one by one in a partition. If a consumer fails to execute the consumption logic after the consumer receives a message, you can use the following methods for troubleshooting. An example of such a failure is that a message fails to be processed due to dirty data on the application server.
(1) Keep trying to execute the consumption logic upon a failure. This method may block the consumption thread at the current message and cause message accumulation.
(2) Kafka does not specify the logic to process failed messages. You can export failed messages or store the messages in a service. For example, you can create a topic that is dedicated to storing failed messages. Then, you can regularly check the failed messages, analyze the causes, and take appropriate measures.