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?

FewerLinesThanYou |

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.

iBuiltUber | 0

A ConcurrentMessageListenerContainer manages a collection of KafkaMessageListenerContainer.