Backport of https://github.com/spring-projects/spring-kafka/commit/5beb8fe607bd131ced632dbc7afa32e11a6ff2dd