KafkaMessageListenerContainer vs ConcurrentMessageListenerContainer?

I understand how both classes can be used to implement Kafka listeners in Spring Boot but when should you use one over the other??? Any help appreciated!

Your thoughts?


Kafka consumers are not thread safe. For these reasons, most people rely on the ConcurrentMessageListenerContainer to create a multi-threaded environment for consuming messages.

When you use something like @KafkaListener it's utilizing the ConcurrentMessageListenerContainer automatically as the default container factory.


A ConcurrentMessageListenerContainer manages a collection of KafkaMessageListenerContainer.