修改kafka配置
This commit is contained in:
@@ -10,12 +10,8 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.kafka.annotation.KafkaListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName CorpusProcessKafkaConsumer
|
||||
@@ -26,7 +22,6 @@ import java.util.Date;
|
||||
**/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RestController
|
||||
public class CorpusProcessKafkaConsumer {
|
||||
|
||||
@Autowired
|
||||
@@ -34,11 +29,10 @@ public class CorpusProcessKafkaConsumer {
|
||||
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@GetMapping("corpusProcessKafkaConsumer")
|
||||
// @KafkaListener(topics = "aicorpus-telephone", groupId = "test-group")
|
||||
public void listen(@RequestBody String message) {
|
||||
@KafkaListener(topics = "${spring.kafka.topic}", groupId = "${spring.kafka.group}")
|
||||
public void listen(String message) {
|
||||
try {
|
||||
log.info("Received message: {}" , message);
|
||||
log.info("CorpusProcessKafkaConsumer Received message: {}" , message);
|
||||
|
||||
AicorpusTelephoneDTO aicorpusTelephone = objectMapper.readValue(message, AicorpusTelephoneDTO.class);
|
||||
log.info("aicorpusTelephone categoryCode:{}, display: {}" ,aicorpusTelephone.getCategoryCode(), aicorpusTelephone.getDisplay());
|
||||
|
||||
Reference in New Issue
Block a user