This commit is contained in:
孙小云 2026-02-11 09:42:07 +08:00
parent 572c13a93a
commit 8ab18a5860
1 changed files with 10 additions and 0 deletions

View File

@ -81,12 +81,22 @@ public class TuohengMqttMessageHandler {
try {
log.debug("收到MQTT消息 - Topic: {}", topic);
// 如果是 confirm 消息打印详细日志
if (topic.contains("/control/confirm")) {
log.info("【收到confirm消息】Topic: {}, Payload: {}", topic, payload);
}
// 通知 MqttCallbackRegistry 处理回调用于指令回调
if (mqttCallbackRegistry != null) {
try {
// payload 解析为 JSON 对象传递给回调注册中心
Object messageBody = objectMapper.readValue(payload, Object.class);
mqttCallbackRegistry.handleMessage(topic, messageBody);
// 如果是 confirm 消息打印回调处理结果
if (topic.contains("/control/confirm")) {
log.info("【confirm消息已传递给回调注册中心】Topic: {}", topic);
}
} catch (Exception e) {
log.debug("通知回调注册中心失败: {}", e.getMessage());
}