From eb95d38454ca76addff1b5642a8235dde7e60edd Mon Sep 17 00:00:00 2001 From: aijinhui <aijinhui> Date: 星期六, 23 三月 2024 08:35:42 +0800 Subject: [PATCH] mqttmqtt --- ard-work/src/main/java/com/ruoyi/utils/qymqtt/AutoMqtt.java | 34 ++++++++++++++-------------------- 1 files changed, 14 insertions(+), 20 deletions(-) diff --git a/ard-work/src/main/java/com/ruoyi/utils/qymqtt/AutoMqtt.java b/ard-work/src/main/java/com/ruoyi/utils/qymqtt/AutoMqtt.java index a945fb0..688c0bf 100644 --- a/ard-work/src/main/java/com/ruoyi/utils/qymqtt/AutoMqtt.java +++ b/ard-work/src/main/java/com/ruoyi/utils/qymqtt/AutoMqtt.java @@ -21,26 +21,20 @@ @PostConstruct public void init() { -// ArdSyCarRtuService carRtuService = SpringUtils.getBean(ArdSyCarRtuService.class); -// //鑾峰彇鐢电閿佸湴鍧� -// String mqttUrl = carRtuService.url("ElectromagneticLockUrl"); - List<ArdSyCarRtu> rtus = ardSyCarRtuService.allCarTopicList(); - for (int i = 0; i < rtus.size(); i++) { - ArdSyCarRtu rtu = rtus.get(i); - String carId = rtu.getCarId(); - String subscribe = rtu.getTopicSubscribe(); - try { -// MqttCustomerClient mqttCustomerClient = new MqttCustomerClient(); -// mqttCustomerClient.connect(carId+"mqtt"+ UUID.randomUUID()); -// mqttCustomerClient.subscribe(subscribe); - EmqClient emqClient = new EmqClient(carId+"mqttSubscribe"+UUID.randomUUID()); - emqClient.connect(); - emqClient.subscribe(subscribe, QosEnum.QoS2); - log.debug("璁㈤槄涓婚锛�"+subscribe); - }catch (Exception e) { - e.printStackTrace(); - } - } +// List<ArdSyCarRtu> rtus = ardSyCarRtuService.allCarTopicList(); +// for (int i = 0; i < rtus.size(); i++) { +// ArdSyCarRtu rtu = rtus.get(i); +// String carId = rtu.getCarId(); +// String subscribe = rtu.getTopicSubscribe(); +// try { +// EmqClient emqClient = new EmqClient(carId+"mqttSubscribe"+UUID.randomUUID()); +// emqClient.connect(); +// emqClient.subscribe(subscribe, QosEnum.QoS2); +// log.debug("璁㈤槄涓婚锛�"+subscribe); +// }catch (Exception e) { +// e.printStackTrace(); +// } +// } } -- Gitblit v1.9.3