This commit is contained in:
parent
572c13a93a
commit
8ab18a5860
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue