use of com.aws.greengrass.security.exceptions.MqttConnectionProviderException in project aws-greengrass-nucleus by aws-greengrass.
the class SecurityService method getDeviceIdentityMqttConnectionBuilder.
/**
* Get AWS IoT Mqtt Connection Builder by using default device identity.
*
* @return AwsIotMqttConnectionBuilder that build mqtt client
* @throws MqttConnectionProviderException if mqtt connection provider fails to create builder
*/
@SuppressWarnings({ "PMD.AvoidCatchingGenericException", "PMD.PreserveStackTrace" })
public AwsIotMqttConnectionBuilder getDeviceIdentityMqttConnectionBuilder() throws MqttConnectionProviderException {
URI privateKey = getDeviceIdentityPrivateKeyURI();
URI certPath = getDeviceIdentityCertificateURI();
try {
return RetryUtils.runWithRetry(GET_MQTT_CONNECTION_BUILDER_RETRY_CONFIG, () -> getMqttConnectionBuilder(privateKey, certPath), "get-mqtt-connection-builder", logger);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new MqttConnectionProviderException("Get mqtt connection builder interrupted", e);
} catch (Exception e) {
throw new MqttConnectionProviderException("Error during getting mqtt connection builder", e);
}
}
Aggregations