KafkaMessageListenerContainer vs ConcurrentMessageListenerContainer?
blazingSaddles
Last updated on
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?
Share your thoughts
A ConcurrentMessageListenerContainer manages a collection of KafkaMessageListenerContainer.
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.