MQTT消费

This commit is contained in:
cbs 2025-06-12 16:17:47 +08:00
parent 2e03d0780c
commit 84b0106cc7
3 changed files with 6 additions and 6 deletions

View File

@ -23,11 +23,11 @@ public class CommonApiImpl implements CommonApi {
try {
String str = JSON.toJSONString(obj);
mqttUtils.pub(topic, JSON.toJSONString(obj));
if (str.length() > 510) {
/*if (str.length() > 510) {
log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str.substring(0, 500));
}else {
log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str);
}
}*/
} catch (MqttException e) {
log.info("MQTT消息发送异常 :{}",e);
}
@ -37,11 +37,11 @@ public class CommonApiImpl implements CommonApi {
public void commonMethodStr(String str, String topic) {
try {
mqttUtils.pub(topic, str);
if (str.length() > 510) {
/*if (str.length() > 510) {
log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str.substring(0, 500));
}else {
log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str);
}
}*/
} catch (MqttException e) {
log.info("MQTT消息发送异常 :{}",e);
}

View File

@ -22,7 +22,7 @@ public class RobotStatusServiceImpl implements MqttService {
*/
@Override
public void analysisMessage(String message) {
log.info("处理RobotStatusServiceImpl的消息 :{}", message);
// log.info("处理RobotStatusServiceImpl的消息 :{}", message);
RobotPoseStatusDTO robotStatusData = JSON.parseObject(message, RobotPoseStatusDTO.class);
robotStatusApi.robotStatusUpdate(robotStatusData);
}

View File

@ -47,7 +47,7 @@ public class RobotStatusApiImpl implements RobotStatusApi {
@Resource
private RequestProcessor processor;
private static final ExecutorService executorService = Executors.newFixedThreadPool(20);
private static final ExecutorService executorService = Executors.newFixedThreadPool(50);
@Resource
private CommonApi commonApi;