7

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.

1 Answer 1

6

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.