This commit is contained in:
Shikong 2023-04-25 14:53:50 +08:00
parent 34b1d06ec5
commit c2f6bac38d
3 changed files with 6 additions and 5 deletions

View File

@ -3,6 +3,7 @@ package cn.skcks.study.springcloud.kafka.producer.controller;
import cn.skcks.study.springcloud.kafka.common.model.dto.Message;
import cn.skcks.study.springcloud.utils.JsonUtils;
import com.fasterxml.jackson.core.JsonProcessingException;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
@ -10,8 +11,8 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
@RestController
@AllArgsConstructor
public class SimpleController {
@Autowired
private KafkaTemplate<Object, String> kafkaTemplate;
final static String TOPIC_NAME = "test";

View File

@ -1,7 +1,7 @@
spring:
kafka:
# bootstrap-servers: 10.10.10.200:9092
bootstrap-servers: 10.10.10.200:9192,10.10.10.200:9292,10.10.10.200:9392
bootstrap-servers: 10.10.10.200:9092
# bootstrap-servers: 10.10.10.200:9192,10.10.10.200:9292,10.10.10.200:9392
producer:
retries: 1

View File

@ -1,7 +1,7 @@
spring:
kafka:
# bootstrap-servers: 10.10.10.200:9092
bootstrap-servers: 10.10.10.200:9192,10.10.10.200:9292,10.10.10.200:9392
bootstrap-servers: 10.10.10.200:9092
# bootstrap-servers: 10.10.10.200:9192,10.10.10.200:9292,10.10.10.200:9392
producer:
retries: 1