//package com.muyu.kafka;
//
//import com.muyu.iotDB.service.IotDbServer;
//import com.muyu.mqtt.dao.MessageData;
//import lombok.extern.log4j.Log4j2;
//import org.apache.iotdb.rpc.IoTDBConnectionException;
//import org.apache.iotdb.rpc.StatementExecutionException;
//import org.apache.kafka.clients.consumer.ConsumerConfig;
//import org.apache.kafka.clients.consumer.ConsumerRecord;
//import org.apache.kafka.clients.consumer.ConsumerRecords;
//import org.apache.kafka.clients.consumer.KafkaConsumer;
//import org.apache.kafka.common.TopicPartition;
//import org.apache.kafka.common.serialization.StringDeserializer;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.kafka.annotation.KafkaListener;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//import java.rmi.ServerException;
//import java.time.Duration;
//import java.util.ArrayList;
//import java.util.Collections;
//import java.util.List;
//import java.util.Properties;
//import java.util.concurrent.ConcurrentLinkedQueue;
//
///**
// * 定时器 SimpleKafkaConsumer
// *
// * @author Yangle
// * Date 2024/6/16 22:18
// */
//@Component
//@Log4j2
//public class SimpleKafkaConsumer1 {
//
//
//    @Autowired
//    private RedisTemplate<String,String> redisTemplate;
//
//    public void consumer1() {
//        System.out.println(123);
//    }
//
//
//
//    @KafkaListener(topics = "test1", groupId = "Topics")
//    public void consume(ConsumerRecord<String, String> record) {
//        log.info("添加reids");
//        try {
//            System.out.printf("offset = %d, key = %s, value = %s%n", record.offset(), record.key(), record.value());
//            String value = record.value();
//            log.info("value:{}", value);
//            MessageData messageData = com.alibaba.fastjson2.JSONObject.parseObject(value, MessageData.class);
//            log.info("messageData:{}", messageData);
//
//        } catch (Exception e) {
//            log.error("Error consuming Kafka message", e);
//            // 处理异常，可能需要重试或其他逻辑
//        }
//    }
//
//
//}
//
