//package com.ruoyi.dataprocess.mqtt.client.service;
//
//import com.ruoyi.dataprocess.mqtt.client.config.MqttConfiguration;
//import com.ruoyi.dataprocess.mqtt.client.listener.MqttClientConnectListener;
//import com.ruoyi.dataprocess.mqtt.client.listener.MqttClientMessageListener;
//import net.dreamlu.iot.mqtt.codec.MqttQoS;
//import net.dreamlu.iot.mqtt.core.client.MqttClient;
//import net.dreamlu.iot.mqtt.spring.client.MqttClientTemplate;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//import org.springframework.stereotype.Service;
//
//import javax.annotation.PostConstruct;
//import java.nio.charset.StandardCharsets;
//import java.util.Arrays;
//
///**
// * @Description: MQTT客户端服务
// * @ClassName: ClientService
// * @Author : xins
// * @Date :2023-08-31  14:33
// * @Version :1.0
// */
//public class ClientService {
//    private static final Logger logger = LoggerFactory.getLogger(ClientService.class);
//
//    private MqttClientTemplate client;
//
//    public boolean publish(String body) {
//        client.publish("/test/client", body.getBytes(StandardCharsets.UTF_8));
//        return true;
//    }
//
//    public boolean sub(String topic) {
//        client.subQos0(topic, new MqttClientMessageListener());
////        String[] topicsArr = topics.split(",");
////        Arrays.asList(topicsArr).forEach(topicFilter ->
////                client.subQos0(topicFilter, new MqttClientMessageListener())
////        );
//        return true;
//    }
//
//}
