package com.sandu.ximon.admin.localMQTT.controller;
|
|
import com.sandu.ximon.admin.localMQTT.util.MqttClientUtil;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import static java.lang.Thread.sleep;
|
|
/**
|
* @author van
|
* @version 1.0
|
* msg:
|
* @date 2022/11/11 14:18
|
*/
|
@RestController
|
@RequestMapping("/localMQTT")
|
@Slf4j
|
public class localMQTTTestController {
|
|
|
@RequestMapping("/test")
|
public static String localMQTT() throws InterruptedException {
|
|
for (int i = 0; i < 10; i++) {
|
|
String result1 = MqttClientUtil.sendMqttMsg("363832544E5008FF3A32FFFF",
|
"FEA501000BFE010003FFFF0045971477B6D8C2CA");
|
log.info("返回结果:"+result1);
|
sleep(1000);
|
String result2 = MqttClientUtil.sendMqttMsg("363832544E5008FF3A32FFFF",
|
"FEA501000BFE010003FFFF640F48B1367ABDE0B9");
|
log.info("返回结果:"+result2);
|
sleep(1000);
|
|
}
|
|
|
return "OK";
|
}
|
}
|