修复mqtt 自注册可能失效问题

This commit is contained in:
zhou-hao 2020-09-21 17:11:47 +08:00
parent 75e21ccab8
commit c9fda0f30c
1 changed files with 3 additions and 1 deletions

View File

@ -241,7 +241,9 @@ class MqttServerDeviceGateway implements DeviceGateway, MonitorSupportDeviceGate
if (anotherSession == null) {
return registry
.getDevice(msg.getDeviceId())
.flatMap(device -> handleMessage(device.getDeviceId(), device, msg, session));
.map(device -> handleMessage(device.getDeviceId(), device, msg, session))
.defaultIfEmpty(Mono.defer(()->handleMessage(msg.getDeviceId(), operator, msg, session)))
.flatMap(Function.identity());
}
}
}