This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 51b4b54159cee2b89ce2a83c227af75528858969
Author: Andrea Cosentino <[email protected]>
AuthorDate: Tue Jul 21 11:42:07 2020 +0200

    CAMEL-15310 - AWS* - Support for more than 1 client in the registry - 
Camel-AWS2-DDBStreams
---
 .../ddbstream/Ddb2StreamComponentConfigurer.java   |  5 ++++
 .../ddbstream/Ddb2StreamEndpointConfigurer.java    |  5 ++++
 .../component/aws2/ddbstream/aws2-ddbstream.json   |  2 ++
 .../src/main/docs/aws2-ddbstream-component.adoc    |  6 +++--
 .../aws2/ddbstream/Ddb2StreamComponent.java        |  4 ++-
 .../aws2/ddbstream/Ddb2StreamConfiguration.java    | 11 ++++++++
 .../dsl/Aws2DdbstreamComponentBuilderFactory.java  | 16 ++++++++++++
 .../dsl/Ddb2StreamEndpointBuilderFactory.java      | 30 ++++++++++++++++++++++
 8 files changed, 76 insertions(+), 3 deletions(-)

diff --git 
a/components/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamComponentConfigurer.java
 
b/components/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamComponentConfigurer.java
index 773c5f7..1405cf7 100644
--- 
a/components/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamComponentConfigurer.java
+++ 
b/components/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamComponentConfigurer.java
@@ -30,6 +30,8 @@ public class Ddb2StreamComponentConfigurer extends 
PropertyConfigurerSupport imp
         case "accessKey": 
getOrCreateConfiguration(target).setAccessKey(property(camelContext, 
java.lang.String.class, value)); return true;
         case "amazondynamodbstreamsclient":
         case "amazonDynamoDbStreamsClient": 
getOrCreateConfiguration(target).setAmazonDynamoDbStreamsClient(property(camelContext,
 software.amazon.awssdk.services.dynamodb.streams.DynamoDbStreamsClient.class, 
value)); return true;
+        case "autodiscoverclient":
+        case "autoDiscoverClient": 
getOrCreateConfiguration(target).setAutoDiscoverClient(property(camelContext, 
boolean.class, value)); return true;
         case "basicpropertybinding":
         case "basicPropertyBinding": 
target.setBasicPropertyBinding(property(camelContext, boolean.class, value)); 
return true;
         case "bridgeerrorhandler":
@@ -61,6 +63,7 @@ public class Ddb2StreamComponentConfigurer extends 
PropertyConfigurerSupport imp
         Map<String, Object> answer = new CaseInsensitiveMap();
         answer.put("accessKey", java.lang.String.class);
         answer.put("amazonDynamoDbStreamsClient", 
software.amazon.awssdk.services.dynamodb.streams.DynamoDbStreamsClient.class);
+        answer.put("autoDiscoverClient", boolean.class);
         answer.put("basicPropertyBinding", boolean.class);
         answer.put("bridgeErrorHandler", boolean.class);
         answer.put("configuration", 
org.apache.camel.component.aws2.ddbstream.Ddb2StreamConfiguration.class);
@@ -84,6 +87,8 @@ public class Ddb2StreamComponentConfigurer extends 
PropertyConfigurerSupport imp
         case "accessKey": return 
getOrCreateConfiguration(target).getAccessKey();
         case "amazondynamodbstreamsclient":
         case "amazonDynamoDbStreamsClient": return 
getOrCreateConfiguration(target).getAmazonDynamoDbStreamsClient();
+        case "autodiscoverclient":
+        case "autoDiscoverClient": return 
getOrCreateConfiguration(target).isAutoDiscoverClient();
         case "basicpropertybinding":
         case "basicPropertyBinding": return target.isBasicPropertyBinding();
         case "bridgeerrorhandler":
diff --git 
a/components/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamEndpointConfigurer.java
 
b/components/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamEndpointConfigurer.java
index 6e48507..39cba32 100644
--- 
a/components/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamEndpointConfigurer.java
+++ 
b/components/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamEndpointConfigurer.java
@@ -23,6 +23,8 @@ public class Ddb2StreamEndpointConfigurer extends 
PropertyConfigurerSupport impl
         case "accessKey": 
target.getConfiguration().setAccessKey(property(camelContext, 
java.lang.String.class, value)); return true;
         case "amazondynamodbstreamsclient":
         case "amazonDynamoDbStreamsClient": 
target.getConfiguration().setAmazonDynamoDbStreamsClient(property(camelContext, 
software.amazon.awssdk.services.dynamodb.streams.DynamoDbStreamsClient.class, 
value)); return true;
+        case "autodiscoverclient":
+        case "autoDiscoverClient": 
target.getConfiguration().setAutoDiscoverClient(property(camelContext, 
boolean.class, value)); return true;
         case "backofferrorthreshold":
         case "backoffErrorThreshold": 
target.setBackoffErrorThreshold(property(camelContext, int.class, value)); 
return true;
         case "backoffidlethreshold":
@@ -87,6 +89,7 @@ public class Ddb2StreamEndpointConfigurer extends 
PropertyConfigurerSupport impl
         Map<String, Object> answer = new CaseInsensitiveMap();
         answer.put("accessKey", java.lang.String.class);
         answer.put("amazonDynamoDbStreamsClient", 
software.amazon.awssdk.services.dynamodb.streams.DynamoDbStreamsClient.class);
+        answer.put("autoDiscoverClient", boolean.class);
         answer.put("backoffErrorThreshold", int.class);
         answer.put("backoffIdleThreshold", int.class);
         answer.put("backoffMultiplier", int.class);
@@ -128,6 +131,8 @@ public class Ddb2StreamEndpointConfigurer extends 
PropertyConfigurerSupport impl
         case "accessKey": return target.getConfiguration().getAccessKey();
         case "amazondynamodbstreamsclient":
         case "amazonDynamoDbStreamsClient": return 
target.getConfiguration().getAmazonDynamoDbStreamsClient();
+        case "autodiscoverclient":
+        case "autoDiscoverClient": return 
target.getConfiguration().isAutoDiscoverClient();
         case "backofferrorthreshold":
         case "backoffErrorThreshold": return target.getBackoffErrorThreshold();
         case "backoffidlethreshold":
diff --git 
a/components/camel-aws2-ddb/src/generated/resources/org/apache/camel/component/aws2/ddbstream/aws2-ddbstream.json
 
b/components/camel-aws2-ddb/src/generated/resources/org/apache/camel/component/aws2/ddbstream/aws2-ddbstream.json
index 84887d2..8601ff7 100644
--- 
a/components/camel-aws2-ddb/src/generated/resources/org/apache/camel/component/aws2/ddbstream/aws2-ddbstream.json
+++ 
b/components/camel-aws2-ddb/src/generated/resources/org/apache/camel/component/aws2/ddbstream/aws2-ddbstream.json
@@ -21,6 +21,7 @@
     "lenientProperties": false
   },
   "componentProperties": {
+    "autoDiscoverClient": { "kind": "property", "displayName": "Auto Discover 
Client", "group": "common", "label": "common", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "secret": false, 
"defaultValue": "true", "configurationClass": 
"org.apache.camel.component.aws2.ddbstream.Ddb2StreamConfiguration", 
"configurationField": "configuration", "description": "Setting the 
autoDiscoverClient mechanism, if true, the component will look for a client 
instance i [...]
     "amazonDynamoDbStreamsClient": { "kind": "property", "displayName": 
"Amazon Dynamo Db Streams Client", "group": "consumer", "label": "consumer", 
"required": false, "type": "object", "javaType": 
"software.amazon.awssdk.services.dynamodb.streams.DynamoDbStreamsClient", 
"deprecated": false, "secret": false, "configurationClass": 
"org.apache.camel.component.aws2.ddbstream.Ddb2StreamConfiguration", 
"configurationField": "configuration", "description": "Amazon DynamoDB client 
to use for al [...]
     "bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error 
Handler", "group": "consumer", "label": "consumer", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "secret": false, 
"defaultValue": false, "description": "Allows for bridging the consumer to the 
Camel routing Error Handler, which mean any exceptions occurred while the 
consumer is trying to pickup incoming messages, or the likes, will now be 
processed as a message and handled by [...]
     "configuration": { "kind": "property", "displayName": "Configuration", 
"group": "consumer", "label": "", "required": false, "type": "object", 
"javaType": 
"org.apache.camel.component.aws2.ddbstream.Ddb2StreamConfiguration", 
"deprecated": false, "secret": false, "description": "The component 
configuration" },
@@ -38,6 +39,7 @@
   },
   "properties": {
     "tableName": { "kind": "path", "displayName": "Table Name", "group": 
"consumer", "label": "consumer", "required": true, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", 
"secret": false, "configurationClass": 
"org.apache.camel.component.aws2.ddbstream.Ddb2StreamConfiguration", 
"configurationField": "configuration", "description": "Name of the dynamodb 
table" },
+    "autoDiscoverClient": { "kind": "parameter", "displayName": "Auto Discover 
Client", "group": "common", "label": "common", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "secret": false, 
"defaultValue": "true", "configurationClass": 
"org.apache.camel.component.aws2.ddbstream.Ddb2StreamConfiguration", 
"configurationField": "configuration", "description": "Setting the 
autoDiscoverClient mechanism, if true, the component will look for a client 
instance  [...]
     "amazonDynamoDbStreamsClient": { "kind": "parameter", "displayName": 
"Amazon Dynamo Db Streams Client", "group": "consumer", "label": "consumer", 
"required": false, "type": "object", "javaType": 
"software.amazon.awssdk.services.dynamodb.streams.DynamoDbStreamsClient", 
"deprecated": false, "secret": false, "configurationClass": 
"org.apache.camel.component.aws2.ddbstream.Ddb2StreamConfiguration", 
"configurationField": "configuration", "description": "Amazon DynamoDB client 
to use for a [...]
     "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error 
Handler", "group": "consumer", "label": "consumer", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "secret": false, 
"defaultValue": false, "description": "Allows for bridging the consumer to the 
Camel routing Error Handler, which mean any exceptions occurred while the 
consumer is trying to pickup incoming messages, or the likes, will now be 
processed as a message and handled b [...]
     "iteratorType": { "kind": "parameter", "displayName": "Iterator Type", 
"group": "consumer", "label": "consumer", "required": false, "type": "object", 
"javaType": "software.amazon.awssdk.services.dynamodb.model.ShardIteratorType", 
"enum": [ "TRIM_HORIZON", "LATEST", "AT_SEQUENCE_NUMBER", 
"AFTER_SEQUENCE_NUMBER", "null" ], "deprecated": false, "secret": false, 
"defaultValue": "LATEST", "configurationClass": 
"org.apache.camel.component.aws2.ddbstream.Ddb2StreamConfiguration", "configura 
[...]
diff --git 
a/components/camel-aws2-ddb/src/main/docs/aws2-ddbstream-component.adoc 
b/components/camel-aws2-ddb/src/main/docs/aws2-ddbstream-component.adoc
index 01fa6e1..6585e57 100644
--- a/components/camel-aws2-ddb/src/main/docs/aws2-ddbstream-component.adoc
+++ b/components/camel-aws2-ddb/src/main/docs/aws2-ddbstream-component.adoc
@@ -42,13 +42,14 @@ The stream needs to be created prior to it being used. +
 
 
 // component options: START
-The AWS 2 DynamoDB Streams component supports 14 options, which are listed 
below.
+The AWS 2 DynamoDB Streams component supports 15 options, which are listed 
below.
 
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
+| *autoDiscoverClient* (common) | Setting the autoDiscoverClient mechanism, if 
true, the component will look for a client instance in the registry 
automatically otherwise it will skip that checking | true | boolean
 | *amazonDynamoDbStreamsClient* (consumer) | Amazon DynamoDB client to use for 
all requests for this endpoint |  | DynamoDbStreamsClient
 | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the 
Camel routing Error Handler, which mean any exceptions occurred while the 
consumer is trying to pickup incoming messages, or the likes, will now be 
processed as a message and handled by the routing Error Handler. By default the 
consumer will use the org.apache.camel.spi.ExceptionHandler to deal with 
exceptions, that will be logged at WARN or ERROR level and ignored. | false | 
boolean
 | *configuration* (consumer) | The component configuration |  | 
Ddb2StreamConfiguration
@@ -90,12 +91,13 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (32 parameters):
+=== Query Parameters (33 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
+| *autoDiscoverClient* (common) | Setting the autoDiscoverClient mechanism, if 
true, the component will look for a client instance in the registry 
automatically otherwise it will skip that checking | true | boolean
 | *amazonDynamoDbStreamsClient* (consumer) | Amazon DynamoDB client to use for 
all requests for this endpoint |  | DynamoDbStreamsClient
 | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the 
Camel routing Error Handler, which mean any exceptions occurred while the 
consumer is trying to pickup incoming messages, or the likes, will now be 
processed as a message and handled by the routing Error Handler. By default the 
consumer will use the org.apache.camel.spi.ExceptionHandler to deal with 
exceptions, that will be logged at WARN or ERROR level and ignored. | false | 
boolean
 | *iteratorType* (consumer) | Defines where in the DynaboDB stream to start 
getting records. Note that using TRIM_HORIZON can cause a significant delay 
before the stream has caught up to real-time. if {AT,AFTER}_SEQUENCE_NUMBER are 
used, then a sequenceNumberProvider MUST be supplied. The value can be one of: 
TRIM_HORIZON, LATEST, AT_SEQUENCE_NUMBER, AFTER_SEQUENCE_NUMBER, null | LATEST 
| ShardIteratorType
diff --git 
a/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamComponent.java
 
b/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamComponent.java
index 9977485..96f2ff8 100644
--- 
a/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamComponent.java
+++ 
b/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamComponent.java
@@ -57,7 +57,9 @@ public class Ddb2StreamComponent extends DefaultComponent {
         configuration.setTableName(remaining);
         Ddb2StreamEndpoint endpoint = new Ddb2StreamEndpoint(uri, 
configuration, this);
         setProperties(endpoint, parameters);
-        checkAndSetRegistryClient(configuration, endpoint);
+        if (endpoint.getConfiguration().isAutoDiscoverClient()) {
+            checkAndSetRegistryClient(configuration, endpoint);
+        }
         if (configuration.getAmazonDynamoDbStreamsClient() == null && 
(configuration.getAccessKey() == null || configuration.getSecretKey() == null)) 
{
             throw new IllegalArgumentException("amazonDDBStreamsClient or 
accessKey and secretKey must be specified");
         }
diff --git 
a/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamConfiguration.java
 
b/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamConfiguration.java
index cd399ef8..10dd34b 100644
--- 
a/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamConfiguration.java
+++ 
b/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamConfiguration.java
@@ -61,6 +61,9 @@ public class Ddb2StreamConfiguration implements Cloneable {
     private Integer proxyPort;
     @UriParam(defaultValue = "false", description = "If we want to trust all 
certificates in case of overriding the endpoint")
     private boolean trustAllCertificates;
+    @UriParam(label = "common", defaultValue = "true", description = "Setting 
the autoDiscoverClient mechanism, if true, the component will "  
+            + " look for a client instance in the registry automatically 
otherwise it will skip that checking")
+    private boolean autoDiscoverClient = true;
 
     public DynamoDbStreamsClient getAmazonDynamoDbStreamsClient() {
         return amazonDynamoDbStreamsClient;
@@ -157,6 +160,14 @@ public class Ddb2StreamConfiguration implements Cloneable {
     public void setTrustAllCertificates(boolean trustAllCertificates) {
         this.trustAllCertificates = trustAllCertificates;
     }
+    
+    public boolean isAutoDiscoverClient() {
+        return autoDiscoverClient;
+    }
+
+    public void setAutoDiscoverClient(boolean autoDiscoverClient) {
+        this.autoDiscoverClient = autoDiscoverClient;
+    }
 
     // *************************************************
     //
diff --git 
a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2DdbstreamComponentBuilderFactory.java
 
b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2DdbstreamComponentBuilderFactory.java
index 2bbe86e..8ceafed 100644
--- 
a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2DdbstreamComponentBuilderFactory.java
+++ 
b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2DdbstreamComponentBuilderFactory.java
@@ -50,6 +50,21 @@ public interface Aws2DdbstreamComponentBuilderFactory {
             extends
                 ComponentBuilder<Ddb2StreamComponent> {
         /**
+         * Setting the autoDiscoverClient mechanism, if true, the component 
will
+         * look for a client instance in the registry automatically otherwise 
it
+         * will skip that checking.
+         * 
+         * The option is a: <code>boolean</code> type.
+         * 
+         * Default: true
+         * Group: common
+         */
+        default Aws2DdbstreamComponentBuilder autoDiscoverClient(
+                boolean autoDiscoverClient) {
+            doSetProperty("autoDiscoverClient", autoDiscoverClient);
+            return this;
+        }
+        /**
          * Amazon DynamoDB client to use for all requests for this endpoint.
          * 
          * The option is a:
@@ -263,6 +278,7 @@ public interface Aws2DdbstreamComponentBuilderFactory {
                 String name,
                 Object value) {
             switch (name) {
+            case "autoDiscoverClient": 
getOrCreateConfiguration((Ddb2StreamComponent) 
component).setAutoDiscoverClient((boolean) value); return true;
             case "amazonDynamoDbStreamsClient": 
getOrCreateConfiguration((Ddb2StreamComponent) 
component).setAmazonDynamoDbStreamsClient((software.amazon.awssdk.services.dynamodb.streams.DynamoDbStreamsClient)
 value); return true;
             case "bridgeErrorHandler": ((Ddb2StreamComponent) 
component).setBridgeErrorHandler((boolean) value); return true;
             case "configuration": ((Ddb2StreamComponent) 
component).setConfiguration((org.apache.camel.component.aws2.ddbstream.Ddb2StreamConfiguration)
 value); return true;
diff --git 
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Ddb2StreamEndpointBuilderFactory.java
 
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Ddb2StreamEndpointBuilderFactory.java
index 98f1a37..451afaf 100644
--- 
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Ddb2StreamEndpointBuilderFactory.java
+++ 
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Ddb2StreamEndpointBuilderFactory.java
@@ -47,6 +47,36 @@ public interface Ddb2StreamEndpointBuilderFactory {
             return (AdvancedDdb2StreamEndpointBuilder) this;
         }
         /**
+         * Setting the autoDiscoverClient mechanism, if true, the component 
will
+         * look for a client instance in the registry automatically otherwise 
it
+         * will skip that checking.
+         * 
+         * The option is a: <code>boolean</code> type.
+         * 
+         * Default: true
+         * Group: common
+         */
+        default Ddb2StreamEndpointBuilder autoDiscoverClient(
+                boolean autoDiscoverClient) {
+            doSetProperty("autoDiscoverClient", autoDiscoverClient);
+            return this;
+        }
+        /**
+         * Setting the autoDiscoverClient mechanism, if true, the component 
will
+         * look for a client instance in the registry automatically otherwise 
it
+         * will skip that checking.
+         * 
+         * The option will be converted to a <code>boolean</code> type.
+         * 
+         * Default: true
+         * Group: common
+         */
+        default Ddb2StreamEndpointBuilder autoDiscoverClient(
+                String autoDiscoverClient) {
+            doSetProperty("autoDiscoverClient", autoDiscoverClient);
+            return this;
+        }
+        /**
          * Amazon DynamoDB client to use for all requests for this endpoint.
          * 
          * The option is a:

Reply via email to