121
parent
e46b6325c4
commit
903fecc2cc
|
@ -2,7 +2,6 @@ package com.muyu.server.mqtt;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
import com.muyu.common.kafka.constants.KafkaConstants;
|
|
||||||
import com.muyu.domain.CarMessage;
|
import com.muyu.domain.CarMessage;
|
||||||
import com.muyu.server.service.CarMessageService;
|
import com.muyu.server.service.CarMessageService;
|
||||||
import jakarta.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
|
@ -83,7 +82,7 @@ public class Demo {
|
||||||
results[i] = futures.get(i).get();
|
results[i] = futures.get(i).get();
|
||||||
}
|
}
|
||||||
String jsonString = JSONObject.toJSONString( results );
|
String jsonString = JSONObject.toJSONString( results );
|
||||||
ProducerRecord<String, String> producerRecord = new ProducerRecord<>( KafkaConstants.KafkaTopic, jsonString);
|
ProducerRecord<String, String> producerRecord = new ProducerRecord<>( "carJsons", jsonString);
|
||||||
kafkaProducer.send(producerRecord);
|
kafkaProducer.send(producerRecord);
|
||||||
}
|
}
|
||||||
// 接收信息
|
// 接收信息
|
||||||
|
|
Loading…
Reference in New Issue