GPSFlameOutConsumer.java
976 Bytes
package cn.com.glsx.smart.queue;
import cn.com.glsx.smart.queue.base.MessageReceiver;
import cn.com.glsx.smart.service.SmartDeviceStatusService;
import cn.com.glsx.smart.utils.ProtobufConvert;
import cn.com.glsx.smart.vo.Event;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
/**
* GPS熄火数据消费
*
* @author zhouhaibao
* @date 2021/4/10 18:12
*/
@Slf4j
public class GPSFlameOutConsumer extends MessageReceiver {
@Autowired
private SmartDeviceStatusService smartDeviceStatusService;
@Override
public void processMessage(String topic, byte[] message) {
try {
Event event = ProtobufConvert.convertFlameOut(message);
if (event == null) {
return;
}
smartDeviceStatusService.saveEvent(event);
} catch (Exception e) {
e.printStackTrace();
log.info("topic{}消费异常", topic);
}
}
}