The emoji is a non-existing topic, so publishing of messages also fail with the following message: InvalidTopicException: Invalid topics: [😃]. Everything good so far.
The problem is that I now have an infinite loop.
I honestly don't get what else do you expect?
Let's see: you use the DefaultErrorHandler as is, which works at Spring container level & covers events happening BEFORE (and AFTER) whatever happens in the listener POJO.
Then, when it exhausts all attempts prescribed by your BackOff, it executes component that itself throws an error.
It's executing in the same container context, where does it fall then? Back into your DefaultErrorHandler!
And here you go again.
I'm not quite sure what's the reason for "experiment" like this besides sheer boredom and nothing-else-to-do.
But IF there's an engineering reason for this, you can extend the DefaultErrorHandler by overriding the appropriate method of it, likely handleOne() (or implement a whole CommonErrorHandler yourself) and deal with the situation.
And to top all that...
I throw an exception in the Kafka listener code, so messages will fail and this error handler will be used.
... if there's an exception in @KafkaListener POJO (means YOUR processing part, not framework's), another error handler is to be utilized - the KafkaListenerErrorHandler implementation.