修改kafka消费
This commit is contained in:
@@ -52,9 +52,10 @@ public class TestController {
|
|||||||
public ResultMsg<Object> mockKafka(@RequestBody String message) {
|
public ResultMsg<Object> mockKafka(@RequestBody String message) {
|
||||||
try {
|
try {
|
||||||
AicorpusTelephoneDTO aicorpusTelephone = objectMapper.readValue(message, AicorpusTelephoneDTO.class);
|
AicorpusTelephoneDTO aicorpusTelephone = objectMapper.readValue(message, AicorpusTelephoneDTO.class);
|
||||||
for (int i = 0; i < 10; i++){
|
log.info("mockKafka:{}",message);
|
||||||
|
for (int i = 0; i < 2; i++){
|
||||||
aicorpusTelephone.setSourceId(aicorpusTelephone.getSourceId().concat("_"+i));
|
aicorpusTelephone.setSourceId(aicorpusTelephone.getSourceId().concat("_"+i));
|
||||||
kafkaTemplate.send(kafkaTopic, JSONObject.toJSONString(aicorpusTelephone)); // 发送 Kafka 消息
|
kafkaTemplate.send("topic_voc_covert_text_log", JSONObject.toJSONString(aicorpusTelephone)); // 发送 Kafka 消息
|
||||||
}
|
}
|
||||||
log.info("Kafka 消息已发送: {}", message);
|
log.info("Kafka 消息已发送: {}", message);
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user