Search in sources :

Example 1 with CertPemCredentials

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);
    }
}
Also used : CertPemCredentials(org.thingsboard.rule.engine.credentials.CertPemCredentials) TbMqttNodeConfiguration(org.thingsboard.rule.engine.mqtt.TbMqttNodeConfiguration) TbNodeException(org.thingsboard.rule.engine.api.TbNodeException) ClientCredentials(org.thingsboard.rule.engine.credentials.ClientCredentials) TbNodeException(org.thingsboard.rule.engine.api.TbNodeException) SSLException(javax.net.ssl.SSLException)

Aggregations

SSLException (javax.net.ssl.SSLException)1 TbNodeException (org.thingsboard.rule.engine.api.TbNodeException)1 CertPemCredentials (org.thingsboard.rule.engine.credentials.CertPemCredentials)1 ClientCredentials (org.thingsboard.rule.engine.credentials.ClientCredentials)1 TbMqttNodeConfiguration (org.thingsboard.rule.engine.mqtt.TbMqttNodeConfiguration)1