package com.fastbee.data.controller.gis.mqtt;

import com.fastbee.mqttclient.PubMqttCallBack;
import com.fastbee.mqttclient.PubMqttClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/mqtt")
public class MqttTest {

    @Autowired
    private PubMqttClient pubMqttClient;

    @Autowired
    private PubMqttCallBack pubMqttCallBack;

    /**
     * 测试平台mqtt发布消息
     */
    @GetMapping("/publish")
    public String test(){
        pubMqttClient.publish(1,true,"/10086/155/cmd/down","mqtt测试主题发布消息！");
        return "test";
    }

    /**
     * 测试创建mqtt客户端
     */
    @GetMapping("/subscribe")
    public String test2(){
//        pubMqttClient
        return "test2";
    }

}
