When a consumer fails to process a record, the SeekToCurrentErrorHandler
kicks in and does its job.
After 10 retries, I can see a log line that the backoff was exhausted for the erroring record, however the logged record now has no headers.
On further inspection, I can see that all retries of the record are correctly linked to the overall Trace, however the logs from KafkaMessageListenerContainer$ListenerConsumer
after each failure, and then the log line from SeekToCurrentErrorHandler
, are not trace aware.
How can I go about fixing this? Should I pass a custom error handler to SeekToCurrentErrorHandler
with my own logger in the hopes that it is trace aware?
Log lines missing the trace:
KafkaMessageListenerContainer$ListenerConsumer [ERROR] Error handler threw an exception
SeekToCurrentErrorHandler [ERROR] Backoff FixedBackOff{...} exhausted for ConsumerRecord(topic=..., ..., headers = RecordHeaders(headers = [], ...), ...)
I have removed some data from the above log lines for the sake of brevity.
Edit: Adding versions
spring-cloud-starter-sleuth: 2.2.4.RELEASE
spring-kafka: 2.5.5.RELEASE