修改bug
parent
38521412a6
commit
af273c12cb
|
@ -38,7 +38,7 @@ import static java.lang.Thread.sleep;
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ModelsKafkaMessage {
|
public class ModelsKafkaMessage {
|
||||||
private static final String TOPIC_NAME = "online";
|
private static final String TOPIC_NAME = "ljy";
|
||||||
private static final String BOOTSTRAP_SERVERS = "39.103.133.136:9092";
|
private static final String BOOTSTRAP_SERVERS = "39.103.133.136:9092";
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,17 +41,17 @@ public class RealTimeDataServiceImpl implements IncidentService {
|
||||||
public void incident(CoupletMsgData coupletMsgData) {
|
public void incident(CoupletMsgData coupletMsgData) {
|
||||||
log.info("实时数据事件开始.....");
|
log.info("实时数据事件开始.....");
|
||||||
RealTimeDataRequest cacheObject = redisService.getCacheObject("vin:" + coupletMsgData.getVin());
|
RealTimeDataRequest cacheObject = redisService.getCacheObject("vin:" + coupletMsgData.getVin());
|
||||||
//判断是否有缓存数据
|
// //判断是否有缓存数据
|
||||||
if (redisService.hasKey("vin:query:" + coupletMsgData.getVin())){
|
// if (redisService.hasKey("vin:query:" + coupletMsgData.getVin())){
|
||||||
redisService.deleteObject("vin:query:" + coupletMsgData.getVin());
|
// redisService.deleteObject("vin:query:" + coupletMsgData.getVin());
|
||||||
}
|
// }
|
||||||
// if (RealTimeJudge.isJudge(coupletMsgData.getVin())) {
|
// if (RealTimeJudge.isJudge(coupletMsgData.getVin())) {
|
||||||
if (coupletMsgData.getVin().equals(cacheObject.getVin())){
|
if (coupletMsgData.getVin().equals(cacheObject.getVin())){
|
||||||
// log.info("有实时数据,值为:[{}]开始传输实时数据", coupletMsgData.getVin());
|
// log.info("有实时数据,值为:[{}]开始传输实时数据", coupletMsgData.getVin());
|
||||||
//判断数据是否一致,
|
//判断数据是否一致,
|
||||||
// if (RealTimeJudge.addRealTime(cacheObject)) {
|
// if (RealTimeJudge.addRealTime(cacheObject)) {
|
||||||
log.info("[{}]有缓存数据,值为:[{}],且缓存数据与实时数据一致,开始传输实时数据", coupletMsgData.getVin(), cacheObject);
|
log.info("[{}]有缓存数据,值为:[{}],且缓存数据与实时数据一致,开始传输实时数据", coupletMsgData.getVin(), cacheObject);
|
||||||
redisService.setCacheObject("vin:query:" + coupletMsgData.getVin(), cacheObject);
|
redisService.setCacheSet("vin:query:" + coupletMsgData.getVin(), coupletMsgData);
|
||||||
redisService.expire("vin:"+coupletMsgData.getVin(),10, TimeUnit.MINUTES);
|
redisService.expire("vin:"+coupletMsgData.getVin(),10, TimeUnit.MINUTES);
|
||||||
// } else {
|
// } else {
|
||||||
// log.info("[{}]有缓存数据,值为:[{}],且缓存数据与实时数据不一致,开始传输实时数据", coupletMsgData.getVin(), cacheObject);
|
// log.info("[{}]有缓存数据,值为:[{}],且缓存数据与实时数据不一致,开始传输实时数据", coupletMsgData.getVin(), cacheObject);
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class MqttMonitor {
|
||||||
|
|
||||||
|
|
||||||
//Kafka生产者配置
|
//Kafka生产者配置
|
||||||
private static final String TOPIC_NAME = "dong";
|
private static final String TOPIC_NAME = "ljy";
|
||||||
private static final String BOOTSTRAP_SERVERS = "39.103.133.136:9092";
|
private static final String BOOTSTRAP_SERVERS = "39.103.133.136:9092";
|
||||||
|
|
||||||
//线程池,用于异步处理消息到来时的业务逻辑
|
//线程池,用于异步处理消息到来时的业务逻辑
|
||||||
|
|
|
@ -36,7 +36,7 @@ mqtt:
|
||||||
# broker: mqtt://115.159.47.13:1883
|
# broker: mqtt://115.159.47.13:1883
|
||||||
username:
|
username:
|
||||||
password:
|
password:
|
||||||
clientId: xiaoYao
|
clientId: aaaaaaa
|
||||||
qos: 0
|
qos: 0
|
||||||
topic: xiaoYao
|
topic: xiaoYao
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue