EdrIgnitionConsumer.java
1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package cn.com.glsx.smartkafka.modules.queue;
import cn.com.glsx.smartkafka.modules.queue.base.MessageReceiver;
import cn.com.glsx.smartkafka.modules.service.SmartDeviceStatusService;
import cn.com.glsx.smartkafka.modules.utils.ProtobufConvert;
import cn.com.glsx.smartkafka.modules.model.pb.Event;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
/**
* 记录仪点火数据消费
*
* @author zhouhaibao
* @date 2021/4/10 16:51
*/
@Slf4j
public class EdrIgnitionConsumer extends MessageReceiver {
@Autowired
private SmartDeviceStatusService smartDeviceStatusService;
@Override
public void processMessage(String topic, byte[] message) {
try {
Event event = ProtobufConvert.convertIgnition(message);
if (event == null) {
return;
}
smartDeviceStatusService.saveEvent(event);
} catch (Exception e) {
e.printStackTrace();
log.info("topic{}消费异常", topic);
}
}
}