package com.xinda.mq.rocketmq.listener;

import com.xinda.common.constant.XinDaConstant;
import com.xinda.common.core.mq.DeviceStatusBo;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;

/**
 * RocketMQ监听设备状态消息
 * @author gsb
 * @date 2022/10/11 9:37
 */
@Slf4j
@Component
@RocketMQMessageListener(consumerGroup = XinDaConstant.CHANNEL.DEVICE_STATUS_GROUP , topic = XinDaConstant.CHANNEL.DEVICE_STATUS)
@ConditionalOnProperty(prefix ="cluster", name = "type",havingValue = XinDaConstant.MQTT.ROCKET_MQ)
public class RocketDeviceStatusListener implements RocketMQListener<DeviceStatusBo> {

    @Override
    public void onMessage(DeviceStatusBo deviceStatusBo) {
        log.debug("=>收到设备状态消息,message=[{}]",deviceStatusBo);
    }
}
