1.创建分区
@Configuration
public class KafkaConfiguration {
@Bean
public NewTopic initialTopic() {
return new NewTopic("topic",8, (short) 2 );
}
@Bean
public NewTopic updateTopic() {
return new NewTopic("topic",10, (short) 2 );
}
}
2.创建springboot项目
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId