//package com.base.plan.mq;
//
//import orbit.base.orbit.mq.MqServer;
//import orbit.base.orbit.mq.handler.MessageHandler;
//import orbit.base.orbit.mq.kafka.KafkaMqServer;
//import org.apache.kafka.clients.consumer.KafkaConsumer;
//import org.apache.kafka.common.serialization.StringDeserializer;
//import org.springframework.beans.factory.InitializingBean;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//import java.util.Properties;
//
///**
// * @author jhzhu
// * @date 2023/2/6 10:46
// * @Description: mq接收者
// */
//@Component
//public class MqReceiver implements InitializingBean {
//
//    @Value("${kafka.service.url.list}")
//    private String kafkaServer;
//
//    private String groupId = "plan_1";
//
//    private String enableAutoCommit = "true";
//
//    private String autoCommitIntervalMs = "3000";
//
//    @Value("${kafka.biz.topic.FZ_TASK_MESSAGE}")
//    private String faTaskMessage;
//
//    @Resource
//    MessageHandler basePlatformDispatchTaskHandler;
//
//    @Override
//    public void afterPropertiesSet() throws Exception {
//        Properties properties = new Properties();
//        properties.setProperty("bootstrap.servers", kafkaServer);
//        properties.setProperty("group.id", groupId);
//        properties.setProperty("key.deserializer", StringDeserializer.class.getName());
//        properties.setProperty("value.deserializer", StringDeserializer.class.getName());
//        properties.setProperty("enable.auto.commit", enableAutoCommit);
//        properties.setProperty("auto.commit.interval.ms", autoCommitIntervalMs);
//        properties.setProperty("auto.offset.reset","earliest");
//        KafkaConsumer<String, String> consumer = new KafkaConsumer<>(properties);
//        MqServer mqServer = new KafkaMqServer(consumer, basePlatformDispatchTaskHandler, faTaskMessage);
//        mqServer.start();
//    }
//}