Kafka: Spring @KafkaListener concurrency maps to partitions

concurrency creates that many consumer threads in the group - capped by the partition count.

Code
@KafkaListener(topics = "orders", groupId = "orders-service", concurrency = "3")
void onOrder(ConsumerRecord<String, String> record) { ... }
Output
3 partitions -> 3 threads, one each
6 partitions -> 3 threads, two each
2 partitions -> 3 threads, one permanently idle
Advertisement

Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.

Published 2026-08-11