2021-09-24 架构►mq►kafka spring kafka 连接 Kafka 1234567// 连接 kafka@Beanpublic KafkaAdmin admin() { Map<String, Object> configs = new HashMap<>(); configs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, "127.0.0.1:9092"); return new KafkaAdmin(configs);} 管理 Topic 12345678@Beanpublic NewTopic divinerInternalStrategyOperation() { return TopicBuilder.name("example-topic") .partitions(1) .replicas(1) .compact() .build();} 订阅 topic 1234@KafkaListener(id = "consumer-group", topics = "diviner_internal_strategy_operation")public void listen(String in) { // ...} 发送消息 1234@Autowiredprivate KafkaTemplate<Object, Object> template; template.send(key, value); 参考 https://docs.spring.io/spring-kafka/reference/html/ bean 冲突 Newer kafka for c++ Older MapR