feat: 电子围栏报警
parent
4ad3cfbe8e
commit
366d97e8d2
|
@ -9,7 +9,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.kafka.clients.consumer.ConsumerConfig;
|
import org.apache.kafka.clients.consumer.ConsumerConfig;
|
||||||
import org.apache.kafka.clients.consumer.ConsumerRecords;
|
import org.apache.kafka.clients.consumer.ConsumerRecords;
|
||||||
import org.apache.kafka.clients.consumer.KafkaConsumer;
|
import org.apache.kafka.clients.consumer.KafkaConsumer;
|
||||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -43,8 +42,8 @@ public class ModelsKafkaMessage {
|
||||||
add("stored-event");
|
add("stored-event");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@Autowired
|
// @Autowired
|
||||||
private RabbitTemplate rabbitTemplate;
|
// private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消费者配置
|
* 消费者配置
|
||||||
|
@ -75,15 +74,15 @@ public class ModelsKafkaMessage {
|
||||||
List<CoupletMsgData> coupletMsgDataList = sendMsg(str);
|
List<CoupletMsgData> coupletMsgDataList = sendMsg(str);
|
||||||
for (CoupletMsgData msgData : coupletMsgDataList) {
|
for (CoupletMsgData msgData : coupletMsgDataList) {
|
||||||
log.info("解析到车辆数据:{}", msgData);
|
log.info("解析到车辆数据:{}", msgData);
|
||||||
// for (String string : strings) {
|
for (String string : strings) {
|
||||||
// IncidentService incidentService = SpringUtils.getBean(string);
|
IncidentService incidentService = SpringUtils.getBean(string);
|
||||||
// incidentService.incident(msgData);
|
incidentService.incident(msgData);
|
||||||
// }
|
}
|
||||||
//发送消息
|
//发送消息
|
||||||
rabbitTemplate.convertAndSend("couplet-code-queue",msgData,message -> {
|
// rabbitTemplate.convertAndSend("couplet-code-queue",msgData,message -> {
|
||||||
message.getMessageProperties().setMessageId(UUID.randomUUID().toString());
|
// message.getMessageProperties().setMessageId(UUID.randomUUID().toString());
|
||||||
return message;
|
// return message;
|
||||||
});
|
// });
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sleep(100);
|
sleep(100);
|
||||||
|
|
Loading…
Reference in New Issue