orpiske commented on a change in pull request #5519:
URL: https://github.com/apache/camel/pull/5519#discussion_r627475951



##########
File path: 
components/camel-aws/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Component.java
##########
@@ -58,25 +58,29 @@ protected Endpoint createEndpoint(String uri, String 
remaining, Map<String, Obje
             setProperties(getCamelContext(), this, transientParameters);
         }
 
-        configuration = this.configuration != null ? this.configuration : new 
Sns2Configuration();
-        Sns2Endpoint endpoint = new Sns2Endpoint(uri, this, configuration);
-
         Map<String, Object> nonTransientParameters = 
getNonTransientParameters(parameters);
 
-        setProperties(endpoint, nonTransientParameters);
+        Sns2Configuration epConfiguration = this.configuration != null ? 
this.configuration.copy() : new Sns2Configuration();
 
         if (remaining.startsWith("arn:")) {
-            parseRemaining(remaining);
+            parseRemaining(epConfiguration, remaining);
         } else {
-            configuration.setTopicName(remaining);
-            LOG.debug("Created the endpoint with topic {}", 
configuration.getTopicName());
+            epConfiguration.setTopicName(remaining);
+            LOG.debug("Created the endpoint with topic {}", 
epConfiguration.getTopicName());
         }
 
-        if (!configuration.isUseDefaultCredentialsProvider() && 
configuration.getAmazonSNSClient() == null
-                && (configuration.getAccessKey() == null || 
configuration.getSecretKey() == null)) {
+        Sns2Endpoint endpoint = new Sns2Endpoint(uri, this, epConfiguration);
+        setProperties(endpoint, nonTransientParameters);
+
+        if (!epConfiguration.isUseDefaultCredentialsProvider() && 
epConfiguration.getAmazonSNSClient() == null
+                && (epConfiguration.getAccessKey() == null || 
epConfiguration.getSecretKey() == null)) {
             throw new IllegalArgumentException("AmazonSNSClient or accessKey 
and secretKey must be specified");
         }
 
+        if (this.configuration == null) {
+            setConfiguration(epConfiguration);

Review comment:
       Thanks! I removed these lines and ran a test. It seems to be fine 
without it.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to