|
|
|
@ -25,7 +25,6 @@ import org.thingsboard.mqtt.MqttClientConfig; |
|
|
|
import org.thingsboard.mqtt.MqttConnectResult; |
|
|
|
import org.thingsboard.rule.engine.api.RuleNode; |
|
|
|
import org.thingsboard.rule.engine.api.TbContext; |
|
|
|
import org.thingsboard.rule.engine.api.TbNode; |
|
|
|
import org.thingsboard.rule.engine.api.TbNodeConfiguration; |
|
|
|
import org.thingsboard.rule.engine.api.TbNodeException; |
|
|
|
import org.thingsboard.rule.engine.api.util.TbNodeUtils; |
|
|
|
@ -105,8 +104,13 @@ public class TbMqttNode extends TbAbstractExternalNode { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
String getOwnerId(TbContext ctx) { |
|
|
|
return "Tenant[" + ctx.getTenantId().getId() + "]RuleNode[" + ctx.getSelf().getId().getId() + "]"; |
|
|
|
} |
|
|
|
|
|
|
|
protected MqttClient initClient(TbContext ctx) throws Exception { |
|
|
|
MqttClientConfig config = new MqttClientConfig(getSslContext()); |
|
|
|
config.setOwnerId(getOwnerId(ctx)); |
|
|
|
if (!StringUtils.isEmpty(this.mqttNodeConfiguration.getClientId())) { |
|
|
|
config.setClientId(this.mqttNodeConfiguration.isAppendClientIdSuffix() ? |
|
|
|
this.mqttNodeConfiguration.getClientId() + "_" + ctx.getServiceId() : this.mqttNodeConfiguration.getClientId()); |
|
|
|
|