Topic configuration and message sending (1) Use of KafkaTemplate

1. Theme

1.1. Configure the theme

  • Define a KafkaAdmin Bean in the application context that automatically adds topics to the broker.
    Through this Bean , each newly created topic can be added to the application context. Here's a simple example:

You can also create a TopicBuilder class, which makes it easier to create beans.

@Bean
public KafkaAdmin admin() {
   
    
    
        Map<String, Object> configs = 

Guess you like

Origin blog.csdn.net/qq_35241329/article/details/132762468