LeaveHomeFlagConsumer.java
836 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;
/**
* @author zhouhaibao
* @date 2021/4/9 18:14
*/
@Slf4j
public class LeaveHomeFlagConsumer extends MessageReceiver {
@Autowired
private SmartDeviceStatusService smartDeviceStatusService;
@Override
public void processMessage(String topic, byte[] message) {
log.info("topic{}开始消费",topic);
Event event = ProtobufConvert.convertLeaveHome(message);
if (event == null) {
return;
}
smartDeviceStatusService.saveEvent(event);
}
}