use of org.thingsboard.rule.engine.credentials.CertPemCredentials in project thingsboard by thingsboard.
the class TbAzureIotHubNode method init.
@Override
public void init(TbContext ctx, TbNodeConfiguration configuration) throws TbNodeException {
try {
this.mqttNodeConfiguration = TbNodeUtils.convert(configuration, TbMqttNodeConfiguration.class);
mqttNodeConfiguration.setPort(8883);
mqttNodeConfiguration.setCleanSession(true);
ClientCredentials credentials = mqttNodeConfiguration.getCredentials();
if (CredentialsType.CERT_PEM == credentials.getType()) {
CertPemCredentials pemCredentials = (CertPemCredentials) credentials;
if (pemCredentials.getCaCert() == null || pemCredentials.getCaCert().isEmpty()) {
pemCredentials.setCaCert(AzureIotHubUtil.getDefaultCaCert());
}
}
this.mqttClient = initClient(ctx);
} catch (Exception e) {
throw new TbNodeException(e);
}
}
Aggregations