Search in sources :

Example 1 with MqttConnectionProviderException

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);
    }
}
Also used : MqttConnectionProviderException(com.aws.greengrass.security.exceptions.MqttConnectionProviderException) URI(java.net.URI) KeyLoadingException(com.aws.greengrass.security.exceptions.KeyLoadingException) URISyntaxException(java.net.URISyntaxException) GeneralSecurityException(java.security.GeneralSecurityException) TLSAuthException(com.aws.greengrass.util.exceptions.TLSAuthException) MqttConnectionProviderException(com.aws.greengrass.security.exceptions.MqttConnectionProviderException) IOException(java.io.IOException) ServiceProviderConflictException(com.aws.greengrass.security.exceptions.ServiceProviderConflictException) ServiceUnavailableException(com.aws.greengrass.security.exceptions.ServiceUnavailableException)

Aggregations

KeyLoadingException (com.aws.greengrass.security.exceptions.KeyLoadingException)1 MqttConnectionProviderException (com.aws.greengrass.security.exceptions.MqttConnectionProviderException)1 ServiceProviderConflictException (com.aws.greengrass.security.exceptions.ServiceProviderConflictException)1 ServiceUnavailableException (com.aws.greengrass.security.exceptions.ServiceUnavailableException)1 TLSAuthException (com.aws.greengrass.util.exceptions.TLSAuthException)1 IOException (java.io.IOException)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 GeneralSecurityException (java.security.GeneralSecurityException)1