package com.chinaitop.depot.intelligent.rocketMQ.listenerMQ;

/*import com.alibaba.fastjson.JSON;
import com.chinaitop.depot.intelligent.grainsituation.mapper.TTestdataLayerMapper;
import com.chinaitop.depot.intelligent.grainsituation.model.TTestdata;
import com.chinaitop.depot.intelligent.grainsituation.model.TTestdataLayer;
import com.chinaitop.depot.intelligent.grainsituation.service.TemperatureRecordService;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;*/

/*@Slf4j
@Component
public class MQConsumerService {

    @Resource
    private TemperatureRecordService temperatureRecordService;
    @Resource
    private TTestdataLayerMapper tTestdataLayerMapper;*/


    // topic需要和生产者的topic一致，consumerGroup属性是必须指定的，内容可以随意
    // selectorExpression的意思指的就是tag，默认为“*”，不设置的话会监听所有消息
    /*@Service
    @RocketMQMessageListener(topic = "smart_grp_yn", selectorExpression = "t_testdata_c", consumerGroup = "t_testdata_c")
    public class ConsumerSend implements RocketMQListener<ArrayList<TTestdata>> {
        // 监听到消息就会执行此方法
        @Override
        public void onMessage(ArrayList<TTestdata> tTestdataList) {
            log.info("监听到消息：tTestdataList={}", JSON.toJSONString(tTestdataList));
            temperatureRecordService.insertBatch(tTestdataList);
        }
    }

    // topic需要和生产者的topic一致，consumerGroup属性是必须指定的，内容可以随意
    // selectorExpression的意思指的就是tag，默认为“*”，不设置的话会监听所有消息
    @Service
    @RocketMQMessageListener(topic = "smart_grp_yn", selectorExpression = "t_testdata_layer_c", consumerGroup = "t_testdata_layer_c")
    public class ConsumerSend1 implements RocketMQListener<ArrayList<TTestdataLayer>> {
        // 监听到消息就会执行此方法
        @Override
        public void onMessage(ArrayList<TTestdataLayer> tTestdataLayerArrayList) {
            log.info("监听到消息：tTestdataLayerArrayList={}", JSON.toJSONString(tTestdataLayerArrayList));
            tTestdataLayerMapper.insertBatch(tTestdataLayerArrayList);
        }
    }*/

//}