package com.xinda.mq.rocketmq.listener;

import com.xinda.common.constant.XinDaConstant;
import com.xinda.common.core.mq.DeviceReportBo;
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;

/**
 * MQ监听设备推送消息(上报消息和回调消息)
 * @author gsb
 * @date 2022/10/11 9:51
 */
@Slf4j
@Component
@RocketMQMessageListener(consumerGroup = XinDaConstant.CHANNEL.PUBLISH_GROUP , topic = XinDaConstant.CHANNEL.PUBLISH)
@ConditionalOnProperty(prefix ="cluster", name = "type",havingValue = XinDaConstant.MQTT.ROCKET_MQ)
public class RocketPublishMsgListener implements RocketMQListener<DeviceReportBo> {

    @Override
    public void onMessage(DeviceReportBo bo) {
        log.debug("=>收到设备推送消息,message=[{}]",bo);
    }
}
