Is it possible in Spring Kafka configure the number of partitions for the specific topic in order to be able to effectively use org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory.setConcurrency(Integer) method to parallel consumers on this topic in order to speed up message consumptions and processing? If so, could you please show the example of how it can be done.
Add a comment |
1 Answer
See Configuring Topics.
@Bean public NewTopic topic1() { return new NewTopic("foo", 10, (short) 2); } Will create a topic foo with 10 partitions and a replication factor of 2 (if there is a KafkaAdmin bean in the application context).
Spring boot auto-configures a KafkaAdmin @Bean.