If you wish to stop after a certain number of attempts with an ExponentialBackOff you have to calculate the maxElapsedTime corresponding to the number of attempts.

See https://github.com/spring-projects/spring-kafka/blob/0ee2d49ea525de038d315bc243b62f1004a26dc6/spring-kafka/src/main/java/org/springframework/kafka/support/ExponentialBackOffWithMaxRetries.java#L74-L84

Add a new property to make it more convenient to stop after a certain number of attempts.