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 2c10f0801bd872e5151eb6c444f0fc0708642450 Author: Raffaele Marcello <marcelloraffa...@gmail.com> AuthorDate: Sat Feb 13 16:45:35 2021 +0100 CAMEL-15964 create camel-google-storage omponent --- .../catalog/docs/google-storage-component.adoc | 18 +-- components/camel-google-storage/ReadMe.md | 4 + components/camel-google-storage/pom.xml | 2 +- .../GoogleCloudStorageComponentConfigurer.java | 30 +---- .../GoogleCloudStorageEndpointConfigurer.java | 30 +---- .../GoogleCloudStorageEndpointUriFactory.java | 7 +- .../src/generated/resources/google-storage.json | 2 +- .../component/google/storage/google-storage.json | 14 +- .../src/main/docs/google-storage-component.adoc | 18 +-- .../storage/GoogleCloudStorageComponent.java | 7 - .../GoogleCloudStorageComponentConfiguration.java | 68 +++++----- ...ogleCloudStorageComponentVerifierExtension.java | 82 ------------ .../GoogleCloudStorageConnectionFactory.java | 18 +++ .../google/storage/GoogleCloudStorageConsumer.java | 20 +-- .../google/storage/GoogleCloudStorageEndpoint.java | 34 +++-- .../storage/client/StorageInternalClient.java | 7 - .../client/StorageInternalClientFactory.java | 11 -- .../storage/client/StorageInternalClientImpl.java | 44 ------- .../integration/ConsumerIntegrationTest.java | 93 ++++++++++++++ .../integration/ProducerIntegrationTest.java | 141 +++++++++++++++++++++ .../storage/localstorage/FakeStorageRpc.java | 8 +- ...ogleCloudStorageComponentConfigurationTest.java | 14 +- .../dsl/GoogleStorageComponentBuilderFactory.java | 65 +--------- .../GoogleCloudStorageEndpointBuilderFactory.java | 99 +++------------ .../ROOT/pages/google-storage-component.adoc | 18 +-- 25 files changed, 394 insertions(+), 460 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/google-storage-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/google-storage-component.adoc index c26ce4a..b6cdfc5 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/google-storage-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/google-storage-component.adoc @@ -65,7 +65,7 @@ from("google-storage://myCamelBucket?serviceAccountCredentials=/home/user/Downlo == Options // component options: START -The Google Storage component supports 16 options, which are listed below. +The Google Storage component supports 13 options, which are listed below. @@ -75,18 +75,15 @@ The Google Storage component supports 16 options, which are listed below. | *autoCreateBucket* (common) | Setting the autocreation of the bucket bucketName. | true | boolean | *configuration* (common) | The component configuration | | GoogleCloudStorageComponentConfiguration | *objectName* (common) | objectName | | String -| *serviceAccountCredentials* (common) | Specify the service account credentials file (json) | | String +| *serviceAccountKey* (common) | Service account key | | String | *storageClient* (common) | Set strage client | | Storage | *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 | *deleteAfterRead* (consumer) | Delete objects from S3 after they have been retrieved. The delete is only performed if the Exchange is committed. If a rollback occurs, the object is not deleted. If this option is false, then the same objects will be retrieve over and over again on the polls. Therefore you need to use the Idempotent Consumer EIP in the route to filter out duplicates. You can filter using the AWS2S3Constants#BUCKET_NAME and AWS2S3Constants#KEY headers, or only the AWS2S3C [...] | *destinationBucket* (consumer) | Define the destination bucket where an object must be moved when moveAfterRead is set to true. | | String -| *destinationBucketPrefix* (consumer) | Define the destination bucket prefix to use when an object must be moved and moveAfterRead is set to true. | | String -| *destinationBucketSuffix* (consumer) | Define the destination bucket suffix to use when an object must be moved and moveAfterRead is set to true. | | String | *includeBody* (consumer) | If it is true, the S3Object exchange will be consumed and put into the body and closed. If false the S3Object stream will be put raw into the body and the headers will be set with the S3 object metadata. This option is strongly related to autocloseBody option. In case of setting includeBody to true because the S3Object stream will be consumed then it will also be closed in case of includeBody false then it will be up to the caller to close the S3Object stream [...] -| *includeFolders* (consumer) | If it is true, the folders/directories will be consumed. If it is false, they will be ignored, and Exchanges will not be created for those | true | boolean | *moveAfterRead* (consumer) | Move objects from S3 bucket to a different bucket after they have been retrieved. To accomplish the operation the destinationBucket option must be set. The copy bucket operation is only performed if the Exchange is committed. If a rollback occurs, the object is not moved. | false | boolean | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] -| *operation* (producer) | set the operation for the producer. There are 7 enums and the value can be one of: copyObject, listObjects, deleteObject, deleteBucket, listBuckets, getObject, getObjectRange | | GoogleCloudStorageComponentOperations +| *operation* (producer) | set the operation for the producer. There are 7 enums and the value can be one of: copyObject, listObjects, deleteObject, deleteBucket, listBuckets, getObject, createDownloadLink | | GoogleCloudStorageComponentOperations | *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean |=== // component options: END @@ -110,7 +107,7 @@ with the following path and query parameters: |=== -=== Query Parameters (32 parameters): +=== Query Parameters (29 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -118,22 +115,19 @@ with the following path and query parameters: | Name | Description | Default | Type | *autoCreateBucket* (common) | Setting the autocreation of the bucket bucketName. | true | boolean | *objectName* (common) | objectName | | String -| *serviceAccountCredentials* (common) | Specify the service account credentials file (json) | | String +| *serviceAccountKey* (common) | Service account key | | String | *storageClient* (common) | Set strage client | | Storage | *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 | *deleteAfterRead* (consumer) | Delete objects from S3 after they have been retrieved. The delete is only performed if the Exchange is committed. If a rollback occurs, the object is not deleted. If this option is false, then the same objects will be retrieve over and over again on the polls. Therefore you need to use the Idempotent Consumer EIP in the route to filter out duplicates. You can filter using the AWS2S3Constants#BUCKET_NAME and AWS2S3Constants#KEY headers, or only the AWS2S3C [...] | *destinationBucket* (consumer) | Define the destination bucket where an object must be moved when moveAfterRead is set to true. | | String -| *destinationBucketPrefix* (consumer) | Define the destination bucket prefix to use when an object must be moved and moveAfterRead is set to true. | | String -| *destinationBucketSuffix* (consumer) | Define the destination bucket suffix to use when an object must be moved and moveAfterRead is set to true. | | String | *includeBody* (consumer) | If it is true, the S3Object exchange will be consumed and put into the body and closed. If false the S3Object stream will be put raw into the body and the headers will be set with the S3 object metadata. This option is strongly related to autocloseBody option. In case of setting includeBody to true because the S3Object stream will be consumed then it will also be closed in case of includeBody false then it will be up to the caller to close the S3Object stream [...] -| *includeFolders* (consumer) | If it is true, the folders/directories will be consumed. If it is false, they will be ignored, and Exchanges will not be created for those | true | boolean | *moveAfterRead* (consumer) | Move objects from S3 bucket to a different bucket after they have been retrieved. To accomplish the operation the destinationBucket option must be set. The copy bucket operation is only performed if the Exchange is committed. If a rollback occurs, the object is not moved. | false | boolean | *sendEmptyMessageWhenIdle* (consumer) | If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead. | false | boolean | *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | | ExceptionHandler | *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. There are 3 enums and the value can be one of: InOnly, InOut, InOptionalOut | | ExchangePattern | *pollStrategy* (consumer) | A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel. | | PollingConsumerPollStrategy | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] -| *operation* (producer) | set the operation for the producer. There are 7 enums and the value can be one of: copyObject, listObjects, deleteObject, deleteBucket, listBuckets, getObject, getObjectRange | | GoogleCloudStorageComponentOperations +| *operation* (producer) | set the operation for the producer. There are 7 enums and the value can be one of: copyObject, listObjects, deleteObject, deleteBucket, listBuckets, getObject, createDownloadLink | | GoogleCloudStorageComponentOperations | *backoffErrorThreshold* (scheduler) | The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in. | | int | *backoffIdleThreshold* (scheduler) | The number of subsequent idle polls that should happen before the backoffMultipler should kick-in. | | int | *backoffMultiplier* (scheduler) | To let the scheduled polling consumer backoff if there has been a number of subsequent idles/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening again. When this option is in use then backoffIdleThreshold and/or backoffErrorThreshold must also be configured. | | int diff --git a/components/camel-google-storage/ReadMe.md b/components/camel-google-storage/ReadMe.md index fe73812..ee5f91c 100644 --- a/components/camel-google-storage/ReadMe.md +++ b/components/camel-google-storage/ReadMe.md @@ -25,6 +25,10 @@ When you have the **service account key** you can provide authentication credent `export GOOGLE_APPLICATION_CREDENTIALS="/home/user/Downloads/my-key.json"` +or for windows: + +`$Env:GOOGLE_APPLICATION_CREDENTIALS = "/home/user/Downloads/my-key.json"` + or directly through the component endpoint `from("google-storage://myCamelBucket?serviceAccountCredentials=/home/user/Downloads/my-key.json")` diff --git a/components/camel-google-storage/pom.xml b/components/camel-google-storage/pom.xml index 832fa11..c30357a 100644 --- a/components/camel-google-storage/pom.xml +++ b/components/camel-google-storage/pom.xml @@ -33,7 +33,7 @@ <description>Camel Component for Google Cloud Platform Storage</description> <properties> - <firstVersion>3.7.0</firstVersion> + <firstVersion>3.8.0</firstVersion> </properties> <dependencyManagement> diff --git a/components/camel-google-storage/src/generated/java/org/apache/camel/component/google/storage/GoogleCloudStorageComponentConfigurer.java b/components/camel-google-storage/src/generated/java/org/apache/camel/component/google/storage/GoogleCloudStorageComponentConfigurer.java index 79a1fad..559d418 100644 --- a/components/camel-google-storage/src/generated/java/org/apache/camel/component/google/storage/GoogleCloudStorageComponentConfigurer.java +++ b/components/camel-google-storage/src/generated/java/org/apache/camel/component/google/storage/GoogleCloudStorageComponentConfigurer.java @@ -39,14 +39,8 @@ public class GoogleCloudStorageComponentConfigurer extends PropertyConfigurerSup case "deleteAfterRead": getOrCreateConfiguration(target).setDeleteAfterRead(property(camelContext, boolean.class, value)); return true; case "destinationbucket": case "destinationBucket": getOrCreateConfiguration(target).setDestinationBucket(property(camelContext, java.lang.String.class, value)); return true; - case "destinationbucketprefix": - case "destinationBucketPrefix": getOrCreateConfiguration(target).setDestinationBucketPrefix(property(camelContext, java.lang.String.class, value)); return true; - case "destinationbucketsuffix": - case "destinationBucketSuffix": getOrCreateConfiguration(target).setDestinationBucketSuffix(property(camelContext, java.lang.String.class, value)); return true; case "includebody": case "includeBody": getOrCreateConfiguration(target).setIncludeBody(property(camelContext, boolean.class, value)); return true; - case "includefolders": - case "includeFolders": getOrCreateConfiguration(target).setIncludeFolders(property(camelContext, boolean.class, value)); return true; case "lazystartproducer": case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; case "moveafterread": @@ -54,8 +48,8 @@ public class GoogleCloudStorageComponentConfigurer extends PropertyConfigurerSup case "objectname": case "objectName": getOrCreateConfiguration(target).setObjectName(property(camelContext, java.lang.String.class, value)); return true; case "operation": getOrCreateConfiguration(target).setOperation(property(camelContext, org.apache.camel.component.google.storage.GoogleCloudStorageComponentOperations.class, value)); return true; - case "serviceaccountcredentials": - case "serviceAccountCredentials": getOrCreateConfiguration(target).setServiceAccountCredentials(property(camelContext, java.lang.String.class, value)); return true; + case "serviceaccountkey": + case "serviceAccountKey": getOrCreateConfiguration(target).setServiceAccountKey(property(camelContext, java.lang.String.class, value)); return true; case "storageclient": case "storageClient": getOrCreateConfiguration(target).setStorageClient(property(camelContext, com.google.cloud.storage.Storage.class, value)); return true; default: return false; @@ -76,14 +70,8 @@ public class GoogleCloudStorageComponentConfigurer extends PropertyConfigurerSup case "deleteAfterRead": return boolean.class; case "destinationbucket": case "destinationBucket": return java.lang.String.class; - case "destinationbucketprefix": - case "destinationBucketPrefix": return java.lang.String.class; - case "destinationbucketsuffix": - case "destinationBucketSuffix": return java.lang.String.class; case "includebody": case "includeBody": return boolean.class; - case "includefolders": - case "includeFolders": return boolean.class; case "lazystartproducer": case "lazyStartProducer": return boolean.class; case "moveafterread": @@ -91,8 +79,8 @@ public class GoogleCloudStorageComponentConfigurer extends PropertyConfigurerSup case "objectname": case "objectName": return java.lang.String.class; case "operation": return org.apache.camel.component.google.storage.GoogleCloudStorageComponentOperations.class; - case "serviceaccountcredentials": - case "serviceAccountCredentials": return java.lang.String.class; + case "serviceaccountkey": + case "serviceAccountKey": return java.lang.String.class; case "storageclient": case "storageClient": return com.google.cloud.storage.Storage.class; default: return null; @@ -114,14 +102,8 @@ public class GoogleCloudStorageComponentConfigurer extends PropertyConfigurerSup case "deleteAfterRead": return getOrCreateConfiguration(target).isDeleteAfterRead(); case "destinationbucket": case "destinationBucket": return getOrCreateConfiguration(target).getDestinationBucket(); - case "destinationbucketprefix": - case "destinationBucketPrefix": return getOrCreateConfiguration(target).getDestinationBucketPrefix(); - case "destinationbucketsuffix": - case "destinationBucketSuffix": return getOrCreateConfiguration(target).getDestinationBucketSuffix(); case "includebody": case "includeBody": return getOrCreateConfiguration(target).isIncludeBody(); - case "includefolders": - case "includeFolders": return getOrCreateConfiguration(target).isIncludeFolders(); case "lazystartproducer": case "lazyStartProducer": return target.isLazyStartProducer(); case "moveafterread": @@ -129,8 +111,8 @@ public class GoogleCloudStorageComponentConfigurer extends PropertyConfigurerSup case "objectname": case "objectName": return getOrCreateConfiguration(target).getObjectName(); case "operation": return getOrCreateConfiguration(target).getOperation(); - case "serviceaccountcredentials": - case "serviceAccountCredentials": return getOrCreateConfiguration(target).getServiceAccountCredentials(); + case "serviceaccountkey": + case "serviceAccountKey": return getOrCreateConfiguration(target).getServiceAccountKey(); case "storageclient": case "storageClient": return getOrCreateConfiguration(target).getStorageClient(); default: return null; diff --git a/components/camel-google-storage/src/generated/java/org/apache/camel/component/google/storage/GoogleCloudStorageEndpointConfigurer.java b/components/camel-google-storage/src/generated/java/org/apache/camel/component/google/storage/GoogleCloudStorageEndpointConfigurer.java index 3fe8f99..fe3ab5f 100644 --- a/components/camel-google-storage/src/generated/java/org/apache/camel/component/google/storage/GoogleCloudStorageEndpointConfigurer.java +++ b/components/camel-google-storage/src/generated/java/org/apache/camel/component/google/storage/GoogleCloudStorageEndpointConfigurer.java @@ -36,10 +36,6 @@ public class GoogleCloudStorageEndpointConfigurer extends PropertyConfigurerSupp case "deleteAfterRead": target.getConfiguration().setDeleteAfterRead(property(camelContext, boolean.class, value)); return true; case "destinationbucket": case "destinationBucket": target.getConfiguration().setDestinationBucket(property(camelContext, java.lang.String.class, value)); return true; - case "destinationbucketprefix": - case "destinationBucketPrefix": target.getConfiguration().setDestinationBucketPrefix(property(camelContext, java.lang.String.class, value)); return true; - case "destinationbucketsuffix": - case "destinationBucketSuffix": target.getConfiguration().setDestinationBucketSuffix(property(camelContext, java.lang.String.class, value)); return true; case "exceptionhandler": case "exceptionHandler": target.setExceptionHandler(property(camelContext, org.apache.camel.spi.ExceptionHandler.class, value)); return true; case "exchangepattern": @@ -47,8 +43,6 @@ public class GoogleCloudStorageEndpointConfigurer extends PropertyConfigurerSupp case "greedy": target.setGreedy(property(camelContext, boolean.class, value)); return true; case "includebody": case "includeBody": target.getConfiguration().setIncludeBody(property(camelContext, boolean.class, value)); return true; - case "includefolders": - case "includeFolders": target.getConfiguration().setIncludeFolders(property(camelContext, boolean.class, value)); return true; case "initialdelay": case "initialDelay": target.setInitialDelay(property(camelContext, long.class, value)); return true; case "lazystartproducer": @@ -71,8 +65,8 @@ public class GoogleCloudStorageEndpointConfigurer extends PropertyConfigurerSupp case "schedulerProperties": target.setSchedulerProperties(property(camelContext, java.util.Map.class, value)); return true; case "sendemptymessagewhenidle": case "sendEmptyMessageWhenIdle": target.setSendEmptyMessageWhenIdle(property(camelContext, boolean.class, value)); return true; - case "serviceaccountcredentials": - case "serviceAccountCredentials": target.getConfiguration().setServiceAccountCredentials(property(camelContext, java.lang.String.class, value)); return true; + case "serviceaccountkey": + case "serviceAccountKey": target.getConfiguration().setServiceAccountKey(property(camelContext, java.lang.String.class, value)); return true; case "startscheduler": case "startScheduler": target.setStartScheduler(property(camelContext, boolean.class, value)); return true; case "storageclient": @@ -103,10 +97,6 @@ public class GoogleCloudStorageEndpointConfigurer extends PropertyConfigurerSupp case "deleteAfterRead": return boolean.class; case "destinationbucket": case "destinationBucket": return java.lang.String.class; - case "destinationbucketprefix": - case "destinationBucketPrefix": return java.lang.String.class; - case "destinationbucketsuffix": - case "destinationBucketSuffix": return java.lang.String.class; case "exceptionhandler": case "exceptionHandler": return org.apache.camel.spi.ExceptionHandler.class; case "exchangepattern": @@ -114,8 +104,6 @@ public class GoogleCloudStorageEndpointConfigurer extends PropertyConfigurerSupp case "greedy": return boolean.class; case "includebody": case "includeBody": return boolean.class; - case "includefolders": - case "includeFolders": return boolean.class; case "initialdelay": case "initialDelay": return long.class; case "lazystartproducer": @@ -138,8 +126,8 @@ public class GoogleCloudStorageEndpointConfigurer extends PropertyConfigurerSupp case "schedulerProperties": return java.util.Map.class; case "sendemptymessagewhenidle": case "sendEmptyMessageWhenIdle": return boolean.class; - case "serviceaccountcredentials": - case "serviceAccountCredentials": return java.lang.String.class; + case "serviceaccountkey": + case "serviceAccountKey": return java.lang.String.class; case "startscheduler": case "startScheduler": return boolean.class; case "storageclient": @@ -171,10 +159,6 @@ public class GoogleCloudStorageEndpointConfigurer extends PropertyConfigurerSupp case "deleteAfterRead": return target.getConfiguration().isDeleteAfterRead(); case "destinationbucket": case "destinationBucket": return target.getConfiguration().getDestinationBucket(); - case "destinationbucketprefix": - case "destinationBucketPrefix": return target.getConfiguration().getDestinationBucketPrefix(); - case "destinationbucketsuffix": - case "destinationBucketSuffix": return target.getConfiguration().getDestinationBucketSuffix(); case "exceptionhandler": case "exceptionHandler": return target.getExceptionHandler(); case "exchangepattern": @@ -182,8 +166,6 @@ public class GoogleCloudStorageEndpointConfigurer extends PropertyConfigurerSupp case "greedy": return target.isGreedy(); case "includebody": case "includeBody": return target.getConfiguration().isIncludeBody(); - case "includefolders": - case "includeFolders": return target.getConfiguration().isIncludeFolders(); case "initialdelay": case "initialDelay": return target.getInitialDelay(); case "lazystartproducer": @@ -206,8 +188,8 @@ public class GoogleCloudStorageEndpointConfigurer extends PropertyConfigurerSupp case "schedulerProperties": return target.getSchedulerProperties(); case "sendemptymessagewhenidle": case "sendEmptyMessageWhenIdle": return target.isSendEmptyMessageWhenIdle(); - case "serviceaccountcredentials": - case "serviceAccountCredentials": return target.getConfiguration().getServiceAccountCredentials(); + case "serviceaccountkey": + case "serviceAccountKey": return target.getConfiguration().getServiceAccountKey(); case "startscheduler": case "startScheduler": return target.isStartScheduler(); case "storageclient": diff --git a/components/camel-google-storage/src/generated/java/org/apache/camel/component/google/storage/GoogleCloudStorageEndpointUriFactory.java b/components/camel-google-storage/src/generated/java/org/apache/camel/component/google/storage/GoogleCloudStorageEndpointUriFactory.java index 35339d8..dbd0a68 100644 --- a/components/camel-google-storage/src/generated/java/org/apache/camel/component/google/storage/GoogleCloudStorageEndpointUriFactory.java +++ b/components/camel-google-storage/src/generated/java/org/apache/camel/component/google/storage/GoogleCloudStorageEndpointUriFactory.java @@ -20,12 +20,11 @@ public class GoogleCloudStorageEndpointUriFactory extends org.apache.camel.suppo private static final Set<String> PROPERTY_NAMES; private static final Set<String> SECRET_PROPERTY_NAMES; static { - Set<String> props = new HashSet<>(33); + Set<String> props = new HashSet<>(30); props.add("backoffMultiplier"); props.add("bucketName"); props.add("destinationBucket"); props.add("initialDelay"); - props.add("serviceAccountCredentials"); props.add("scheduler"); props.add("bridgeErrorHandler"); props.add("useFixedDelay"); @@ -35,15 +34,13 @@ public class GoogleCloudStorageEndpointUriFactory extends org.apache.camel.suppo props.add("scheduledExecutorService"); props.add("repeatCount"); props.add("timeUnit"); + props.add("serviceAccountKey"); props.add("autoCreateBucket"); - props.add("destinationBucketSuffix"); props.add("moveAfterRead"); props.add("sendEmptyMessageWhenIdle"); props.add("schedulerProperties"); props.add("exchangePattern"); - props.add("includeFolders"); props.add("storageClient"); - props.add("destinationBucketPrefix"); props.add("backoffIdleThreshold"); props.add("lazyStartProducer"); props.add("delay"); diff --git a/components/camel-google-storage/src/generated/resources/google-storage.json b/components/camel-google-storage/src/generated/resources/google-storage.json index d2e99a6..80bfd6a 100644 --- a/components/camel-google-storage/src/generated/resources/google-storage.json +++ b/components/camel-google-storage/src/generated/resources/google-storage.json @@ -5,7 +5,7 @@ "title": "Google Storage", "description": "Camel Component for Google Cloud Platform Storage", "deprecated": false, - "firstVersion": "3.7.0", + "firstVersion": "3.8.0", "supportLevel": "Preview", "groupId": "org.apache.camel", "artifactId": "camel-google-storage", diff --git a/components/camel-google-storage/src/generated/resources/org/apache/camel/component/google/storage/google-storage.json b/components/camel-google-storage/src/generated/resources/org/apache/camel/component/google/storage/google-storage.json index 7fac5a9..2e1d205 100644 --- a/components/camel-google-storage/src/generated/resources/org/apache/camel/component/google/storage/google-storage.json +++ b/components/camel-google-storage/src/generated/resources/org/apache/camel/component/google/storage/google-storage.json @@ -25,40 +25,34 @@ "autoCreateBucket": { "kind": "property", "displayName": "Auto Create Bucket", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "Setting the autocreation of the bucket bucketName." }, "configuration": { "kind": "property", "displayName": "Configuration", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "The component configuration" }, "objectName": { "kind": "property", "displayName": "Object Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "objectName" }, - "serviceAccountCredentials": { "kind": "property", "displayName": "Service Account Credentials", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "Specify the service account credentials file (json)" }, + "serviceAccountKey": { "kind": "property", "displayName": "Service Account Key", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "Service account key" }, "storageClient": { "kind": "property", "displayName": "Storage Client", "group": "common", "label": "", "required": false, "type": "object", "javaType": "com.google.cloud.storage.Storage", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "Set strage client" }, "bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": 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 me [...] "deleteAfterRead": { "kind": "property", "displayName": "Delete After Read", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "Delete objects from S3 after they have been retrieved. The delete [...] "destinationBucket": { "kind": "property", "displayName": "Destination Bucket", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "Define the destination bucket where an object must be moved when moveAfterRe [...] - "destinationBucketPrefix": { "kind": "property", "displayName": "Destination Bucket Prefix", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "Define the destination bucket prefix to use when an object must [...] - "destinationBucketSuffix": { "kind": "property", "displayName": "Destination Bucket Suffix", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "Define the destination bucket suffix to use when an object must [...] "includeBody": { "kind": "property", "displayName": "Include Body", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "If it is true, the S3Object exchange will be consumed and put into the bod [...] - "includeFolders": { "kind": "property", "displayName": "Include Folders", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "If it is true, the folders\/directories will be consumed. If it is f [...] "moveAfterRead": { "kind": "property", "displayName": "Move After Read", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "Move objects from S3 bucket to a different bucket after they have be [...] "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during star [...] - "operation": { "kind": "property", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentOperations", "enum": [ "copyObject", "listObjects", "deleteObject", "deleteBucket", "listBuckets", "getObject", "getObjectRange" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleClo [...] + "operation": { "kind": "property", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentOperations", "enum": [ "copyObject", "listObjects", "deleteObject", "deleteBucket", "listBuckets", "getObject", "createDownloadLink" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.Googl [...] "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...] }, "properties": { "bucketName": { "kind": "path", "displayName": "Bucket Name", "group": "common", "label": "common", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "Bucket name" }, "autoCreateBucket": { "kind": "parameter", "displayName": "Auto Create Bucket", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "Setting the autocreation of the bucket bucketName." }, "objectName": { "kind": "parameter", "displayName": "Object Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "objectName" }, - "serviceAccountCredentials": { "kind": "parameter", "displayName": "Service Account Credentials", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "Specify the service account credentials file (json)" }, + "serviceAccountKey": { "kind": "parameter", "displayName": "Service Account Key", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "Service account key" }, "storageClient": { "kind": "parameter", "displayName": "Storage Client", "group": "common", "label": "", "required": false, "type": "object", "javaType": "com.google.cloud.storage.Storage", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "Set strage client" }, "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": 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 m [...] "deleteAfterRead": { "kind": "parameter", "displayName": "Delete After Read", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "Delete objects from S3 after they have been retrieved. The delet [...] "destinationBucket": { "kind": "parameter", "displayName": "Destination Bucket", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "Define the destination bucket where an object must be moved when moveAfterR [...] - "destinationBucketPrefix": { "kind": "parameter", "displayName": "Destination Bucket Prefix", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "Define the destination bucket prefix to use when an object mus [...] - "destinationBucketSuffix": { "kind": "parameter", "displayName": "Destination Bucket Suffix", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "Define the destination bucket suffix to use when an object mus [...] "includeBody": { "kind": "parameter", "displayName": "Include Body", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "If it is true, the S3Object exchange will be consumed and put into the bo [...] - "includeFolders": { "kind": "parameter", "displayName": "Include Folders", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "If it is true, the folders\/directories will be consumed. If it is [...] "moveAfterRead": { "kind": "parameter", "displayName": "Move After Read", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration", "configurationField": "configuration", "description": "Move objects from S3 bucket to a different bucket after they have b [...] "sendEmptyMessageWhenIdle": { "kind": "parameter", "displayName": "Send Empty Message When Idle", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead." }, "exceptionHandler": { "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the con [...] "exchangePattern": { "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut", "InOptionalOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, "pollStrategy": { "kind": "parameter", "displayName": "Poll Strategy", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.PollingConsumerPollStrategy", "deprecated": false, "autowired": false, "secret": false, "description": "A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation [...] "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during sta [...] - "operation": { "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentOperations", "enum": [ "copyObject", "listObjects", "deleteObject", "deleteBucket", "listBuckets", "getObject", "getObjectRange" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCl [...] + "operation": { "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.google.storage.GoogleCloudStorageComponentOperations", "enum": [ "copyObject", "listObjects", "deleteObject", "deleteBucket", "listBuckets", "getObject", "createDownloadLink" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.Goog [...] "backoffErrorThreshold": { "kind": "parameter", "displayName": "Backoff Error Threshold", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in." }, "backoffIdleThreshold": { "kind": "parameter", "displayName": "Backoff Idle Threshold", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "The number of subsequent idle polls that should happen before the backoffMultipler should kick-in." }, "backoffMultiplier": { "kind": "parameter", "displayName": "Backoff Multiplier", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "To let the scheduled polling consumer backoff if there has been a number of subsequent idles\/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening agai [...] diff --git a/components/camel-google-storage/src/main/docs/google-storage-component.adoc b/components/camel-google-storage/src/main/docs/google-storage-component.adoc index c26ce4a..b6cdfc5 100644 --- a/components/camel-google-storage/src/main/docs/google-storage-component.adoc +++ b/components/camel-google-storage/src/main/docs/google-storage-component.adoc @@ -65,7 +65,7 @@ from("google-storage://myCamelBucket?serviceAccountCredentials=/home/user/Downlo == Options // component options: START -The Google Storage component supports 16 options, which are listed below. +The Google Storage component supports 13 options, which are listed below. @@ -75,18 +75,15 @@ The Google Storage component supports 16 options, which are listed below. | *autoCreateBucket* (common) | Setting the autocreation of the bucket bucketName. | true | boolean | *configuration* (common) | The component configuration | | GoogleCloudStorageComponentConfiguration | *objectName* (common) | objectName | | String -| *serviceAccountCredentials* (common) | Specify the service account credentials file (json) | | String +| *serviceAccountKey* (common) | Service account key | | String | *storageClient* (common) | Set strage client | | Storage | *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 | *deleteAfterRead* (consumer) | Delete objects from S3 after they have been retrieved. The delete is only performed if the Exchange is committed. If a rollback occurs, the object is not deleted. If this option is false, then the same objects will be retrieve over and over again on the polls. Therefore you need to use the Idempotent Consumer EIP in the route to filter out duplicates. You can filter using the AWS2S3Constants#BUCKET_NAME and AWS2S3Constants#KEY headers, or only the AWS2S3C [...] | *destinationBucket* (consumer) | Define the destination bucket where an object must be moved when moveAfterRead is set to true. | | String -| *destinationBucketPrefix* (consumer) | Define the destination bucket prefix to use when an object must be moved and moveAfterRead is set to true. | | String -| *destinationBucketSuffix* (consumer) | Define the destination bucket suffix to use when an object must be moved and moveAfterRead is set to true. | | String | *includeBody* (consumer) | If it is true, the S3Object exchange will be consumed and put into the body and closed. If false the S3Object stream will be put raw into the body and the headers will be set with the S3 object metadata. This option is strongly related to autocloseBody option. In case of setting includeBody to true because the S3Object stream will be consumed then it will also be closed in case of includeBody false then it will be up to the caller to close the S3Object stream [...] -| *includeFolders* (consumer) | If it is true, the folders/directories will be consumed. If it is false, they will be ignored, and Exchanges will not be created for those | true | boolean | *moveAfterRead* (consumer) | Move objects from S3 bucket to a different bucket after they have been retrieved. To accomplish the operation the destinationBucket option must be set. The copy bucket operation is only performed if the Exchange is committed. If a rollback occurs, the object is not moved. | false | boolean | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] -| *operation* (producer) | set the operation for the producer. There are 7 enums and the value can be one of: copyObject, listObjects, deleteObject, deleteBucket, listBuckets, getObject, getObjectRange | | GoogleCloudStorageComponentOperations +| *operation* (producer) | set the operation for the producer. There are 7 enums and the value can be one of: copyObject, listObjects, deleteObject, deleteBucket, listBuckets, getObject, createDownloadLink | | GoogleCloudStorageComponentOperations | *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean |=== // component options: END @@ -110,7 +107,7 @@ with the following path and query parameters: |=== -=== Query Parameters (32 parameters): +=== Query Parameters (29 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -118,22 +115,19 @@ with the following path and query parameters: | Name | Description | Default | Type | *autoCreateBucket* (common) | Setting the autocreation of the bucket bucketName. | true | boolean | *objectName* (common) | objectName | | String -| *serviceAccountCredentials* (common) | Specify the service account credentials file (json) | | String +| *serviceAccountKey* (common) | Service account key | | String | *storageClient* (common) | Set strage client | | Storage | *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 | *deleteAfterRead* (consumer) | Delete objects from S3 after they have been retrieved. The delete is only performed if the Exchange is committed. If a rollback occurs, the object is not deleted. If this option is false, then the same objects will be retrieve over and over again on the polls. Therefore you need to use the Idempotent Consumer EIP in the route to filter out duplicates. You can filter using the AWS2S3Constants#BUCKET_NAME and AWS2S3Constants#KEY headers, or only the AWS2S3C [...] | *destinationBucket* (consumer) | Define the destination bucket where an object must be moved when moveAfterRead is set to true. | | String -| *destinationBucketPrefix* (consumer) | Define the destination bucket prefix to use when an object must be moved and moveAfterRead is set to true. | | String -| *destinationBucketSuffix* (consumer) | Define the destination bucket suffix to use when an object must be moved and moveAfterRead is set to true. | | String | *includeBody* (consumer) | If it is true, the S3Object exchange will be consumed and put into the body and closed. If false the S3Object stream will be put raw into the body and the headers will be set with the S3 object metadata. This option is strongly related to autocloseBody option. In case of setting includeBody to true because the S3Object stream will be consumed then it will also be closed in case of includeBody false then it will be up to the caller to close the S3Object stream [...] -| *includeFolders* (consumer) | If it is true, the folders/directories will be consumed. If it is false, they will be ignored, and Exchanges will not be created for those | true | boolean | *moveAfterRead* (consumer) | Move objects from S3 bucket to a different bucket after they have been retrieved. To accomplish the operation the destinationBucket option must be set. The copy bucket operation is only performed if the Exchange is committed. If a rollback occurs, the object is not moved. | false | boolean | *sendEmptyMessageWhenIdle* (consumer) | If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead. | false | boolean | *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | | ExceptionHandler | *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. There are 3 enums and the value can be one of: InOnly, InOut, InOptionalOut | | ExchangePattern | *pollStrategy* (consumer) | A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel. | | PollingConsumerPollStrategy | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] -| *operation* (producer) | set the operation for the producer. There are 7 enums and the value can be one of: copyObject, listObjects, deleteObject, deleteBucket, listBuckets, getObject, getObjectRange | | GoogleCloudStorageComponentOperations +| *operation* (producer) | set the operation for the producer. There are 7 enums and the value can be one of: copyObject, listObjects, deleteObject, deleteBucket, listBuckets, getObject, createDownloadLink | | GoogleCloudStorageComponentOperations | *backoffErrorThreshold* (scheduler) | The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in. | | int | *backoffIdleThreshold* (scheduler) | The number of subsequent idle polls that should happen before the backoffMultipler should kick-in. | | int | *backoffMultiplier* (scheduler) | To let the scheduled polling consumer backoff if there has been a number of subsequent idles/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening again. When this option is in use then backoffIdleThreshold and/or backoffErrorThreshold must also be configured. | | int diff --git a/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageComponent.java b/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageComponent.java index d182493..8ff9591 100644 --- a/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageComponent.java +++ b/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageComponent.java @@ -7,14 +7,10 @@ import org.apache.camel.Endpoint; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.annotations.Component; import org.apache.camel.support.DefaultComponent; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; @Component("google-storage") public class GoogleCloudStorageComponent extends DefaultComponent { - private static final Logger LOG = LoggerFactory.getLogger(GoogleCloudStorageComponent.class); - @Metadata private GoogleCloudStorageComponentConfiguration configuration = new GoogleCloudStorageComponentConfiguration(); @@ -24,12 +20,9 @@ public class GoogleCloudStorageComponent extends DefaultComponent { public GoogleCloudStorageComponent(CamelContext context) { super(context); - - //registerExtension(new GoogleCloudStorageComponentVerifierExtension()); } protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { - LOG.debug("create endopoint: uri={}, remaining={}, parameters={}", uri, remaining, parameters); if (remaining == null || remaining.trim().length() == 0) { throw new IllegalArgumentException("Bucket name must be specified."); diff --git a/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageComponentConfiguration.java b/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageComponentConfiguration.java index 058b22b..49e8f8b 100644 --- a/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageComponentConfiguration.java +++ b/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageComponentConfiguration.java @@ -14,11 +14,14 @@ public class GoogleCloudStorageComponentConfiguration implements Cloneable { @Metadata(required = true) private String bucketName; - @UriParam - private String serviceAccountCredentials; //https://cloud.google.com/storage/docs/reference/libraries#setting_up_authentication + @UriParam(label = "common", description = "Service account key") + private String serviceAccountKey; + + //@UriParam(label = "common", description = "ProjectId") + //private String projectId; @UriParam(label = "producer", - enums = "copyObject,listObjects,deleteObject,deleteBucket,listBuckets,getObject,getObjectRange") + enums = "copyObject,listObjects,deleteObject,deleteBucket,listBuckets,getObject,createDownloadLink") private GoogleCloudStorageComponentOperations operation; @UriParam @@ -31,10 +34,10 @@ public class GoogleCloudStorageComponentConfiguration implements Cloneable { private boolean moveAfterRead; @UriParam(label = "consumer") private String destinationBucket; - @UriParam(label = "consumer") - private String destinationBucketPrefix; - @UriParam(label = "consumer") - private String destinationBucketSuffix; + // @UriParam(label = "consumer") + // private String destinationBucketPrefix; + // @UriParam(label = "consumer") + // private String destinationBucketSuffix; @UriParam(label = "consumer", defaultValue = "true") private boolean deleteAfterRead = true; /* @@ -49,8 +52,8 @@ public class GoogleCloudStorageComponentConfiguration implements Cloneable { */ @UriParam(label = "consumer", defaultValue = "true") private boolean includeBody = true; - @UriParam(label = "consumer", defaultValue = "true") - private boolean includeFolders = true; + //@UriParam(label = "consumer", defaultValue = "true") + //private boolean includeFolders = true; @UriParam private Storage storageClient; @@ -66,23 +69,17 @@ public class GoogleCloudStorageComponentConfiguration implements Cloneable { this.bucketName = bucketName; } - public String getServiceAccountCredentials() { - return serviceAccountCredentials; + public String getServiceAccountKey() { + return serviceAccountKey; } /** - * Specify the service account credentials file (json) + * The Service account key that can be used as credentials for the Storage client. + * + * @param serviceAccountKey */ - public void setServiceAccountCredentials(String serviceAccountCredentials) { - this.serviceAccountCredentials = serviceAccountCredentials; - } - - public GoogleCloudStorageComponentConfiguration copy() { - try { - return (GoogleCloudStorageComponentConfiguration) super.clone(); - } catch (CloneNotSupportedException e) { - throw new RuntimeCamelException(e); - } + public void setServiceAccountKey(String serviceAccountKey) { + this.serviceAccountKey = serviceAccountKey; } public String getObjectName() { @@ -157,40 +154,41 @@ public class GoogleCloudStorageComponentConfiguration implements Cloneable { this.destinationBucket = destinationBucket; } + /* public String getDestinationBucketPrefix() { return destinationBucketPrefix; } - + /** * Define the destination bucket prefix to use when an object must be moved and moveAfterRead is set to true. - */ + * public void setDestinationBucketPrefix(String destinationBucketPrefix) { this.destinationBucketPrefix = destinationBucketPrefix; } - + public String getDestinationBucketSuffix() { return destinationBucketSuffix; } - + /** * Define the destination bucket suffix to use when an object must be moved and moveAfterRead is set to true. - */ + * public void setDestinationBucketSuffix(String destinationBucketSuffix) { this.destinationBucketSuffix = destinationBucketSuffix; } - + /** * If it is true, the folders/directories will be consumed. If it is false, they will be ignored, and Exchanges will * not be created for those - */ + * public void setIncludeFolders(boolean includeFolders) { this.includeFolders = includeFolders; } - + public boolean isIncludeFolders() { return includeFolders; } - + */ public boolean isDeleteAfterRead() { return deleteAfterRead; } @@ -223,4 +221,12 @@ public class GoogleCloudStorageComponentConfiguration implements Cloneable { public boolean isIncludeBody() { return includeBody; } + + public GoogleCloudStorageComponentConfiguration copy() { + try { + return (GoogleCloudStorageComponentConfiguration) super.clone(); + } catch (CloneNotSupportedException e) { + throw new RuntimeCamelException(e); + } + } } diff --git a/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageComponentVerifierExtension.java b/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageComponentVerifierExtension.java deleted file mode 100644 index f0f0ba8..0000000 --- a/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageComponentVerifierExtension.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.apache.camel.component.google.storage; - -import java.util.Map; - -import org.apache.camel.component.extension.verifier.DefaultComponentVerifierExtension; -import org.apache.camel.component.extension.verifier.ResultBuilder; -import org.apache.camel.component.extension.verifier.ResultErrorBuilder; -import org.apache.camel.component.extension.verifier.ResultErrorHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class GoogleCloudStorageComponentVerifierExtension extends DefaultComponentVerifierExtension { - - private static final Logger LOG = LoggerFactory.getLogger(GoogleCloudStorageComponentVerifierExtension.class); - - protected GoogleCloudStorageComponentVerifierExtension() { - super("google-storage"); - } - - protected GoogleCloudStorageComponentVerifierExtension(String scheme) { - super(scheme); - } - - // ********************************* - // Parameters validation - // ********************************* - - @Override - protected Result verifyParameters(Map<String, Object> parameters) { - LOG.debug("verifyParameters={}", parameters); - ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.PARAMETERS) - .error(ResultErrorHelper.requiresOption("applicationCredentials", parameters)); - - // Validate using the catalog - - super.verifyParametersAgainstCatalog(builder, parameters); - - return builder.build(); - } - - // ********************************* - // Connectivity validation - // ********************************* - - @Override - protected Result verifyConnectivity(Map<String, Object> parameters) { - LOG.debug("verifyConnectivity={}", parameters); - ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.CONNECTIVITY); - - try { - GoogleCloudStorageComponentConfiguration configuration - = setProperties(new GoogleCloudStorageComponentConfiguration(), parameters); - /* - if (!S3Client.serviceMetadata().regions().contains(Region.of(configuration.getRegion()))) { - ResultErrorBuilder errorBuilder = ResultErrorBuilder.withCodeAndDescription( - VerificationError.StandardCode.ILLEGAL_PARAMETER, "The service is not supported in this region"); - return builder.error(errorBuilder.build()).build(); - } - AwsBasicCredentials cred = AwsBasicCredentials.create(configuration.getAccessKey(), configuration.getSecretKey()); - S3ClientBuilder clientBuilder = S3Client.builder(); - S3Client client = clientBuilder.credentialsProvider(StaticCredentialsProvider.create(cred)) - .region(Region.of(configuration.getRegion())).build(); - client.listBuckets(); - */ - /* - } catch (SdkClientException e) { - ResultErrorBuilder errorBuilder - = ResultErrorBuilder.withCodeAndDescription(VerificationError.StandardCode.AUTHENTICATION, e.getMessage()) - .detail("aws_s3_exception_message", e.getMessage()) - .detail(VerificationError.ExceptionAttribute.EXCEPTION_CLASS, e.getClass().getName()) - .detail(VerificationError.ExceptionAttribute.EXCEPTION_INSTANCE, e); - - builder.error(errorBuilder.build()); - */ - } catch (Exception e) { - builder.error(ResultErrorBuilder.withException(e).build()); - } - - return builder.build(); - } - -} diff --git a/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConnectionFactory.java b/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConnectionFactory.java new file mode 100644 index 0000000..04ede16 --- /dev/null +++ b/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConnectionFactory.java @@ -0,0 +1,18 @@ +package org.apache.camel.component.google.storage; + +import java.io.FileInputStream; + +import com.google.auth.oauth2.ServiceAccountCredentials; +import com.google.cloud.storage.Storage; +import com.google.cloud.storage.StorageOptions; + +public class GoogleCloudStorageConnectionFactory { + + public static Storage create(GoogleCloudStorageComponentConfiguration configuration) throws Exception { + Storage storage = StorageOptions.newBuilder() + .setCredentials(ServiceAccountCredentials.fromStream(new FileInputStream(configuration.getServiceAccountKey()))) + .build().getService(); + return storage; + } + +} diff --git a/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConsumer.java b/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConsumer.java index 20e0ade..92cc6d4 100644 --- a/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConsumer.java +++ b/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConsumer.java @@ -206,16 +206,16 @@ public class GoogleCloudStorageConsumer extends ScheduledBatchPollingConsumer { */ protected boolean includeObject(Blob blob) { - if (getConfiguration().isIncludeFolders()) { - return true; - } else { - //TODO understand if the object is a directory - - // Config says to ignore folders/directories - //return !Optional.of(((GetObjectResponse) s3Object.response()).contentType()).orElse("") - // .toLowerCase().startsWith("application/x-directory"); - return true; - } + // if (getConfiguration().isIncludeFolders()) { + // return true; + // } else { + //TODO understand if the object is a directory + + // Config says to ignore folders/directories + //return !Optional.of(((GetObjectResponse) s3Object.response()).contentType()).orElse("") + // .toLowerCase().startsWith("application/x-directory"); + return true; + //} } @Override diff --git a/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageEndpoint.java b/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageEndpoint.java index 19d5800..a5a3f83 100644 --- a/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageEndpoint.java +++ b/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageEndpoint.java @@ -14,7 +14,6 @@ import org.apache.camel.Message; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.RuntimeCamelException; -import org.apache.camel.component.google.storage.client.StorageInternalClientFactory; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.ScheduledPollEndpoint; @@ -60,20 +59,29 @@ public class GoogleCloudStorageEndpoint extends ScheduledPollEndpoint { @Override protected void doStart() throws Exception { super.doStart(); - this.storageClient = configuration.getStorageClient() != null - ? configuration.getStorageClient() - : StorageInternalClientFactory.getStorageClient(this.configuration).getGoogleCloudStorage(); + + this.storageClient = configuration.getStorageClient(); + if (this.storageClient == null) { + this.storageClient = GoogleCloudStorageConnectionFactory.create(configuration); + } if (configuration.isAutoCreateBucket()) { - Bucket bucket = storageClient.get(configuration.getBucketName()); - if (bucket != null) { - LOG.trace("Bucket [{}] already exists", bucket.getName()); - return; - } else { - // creates the new bucket because it doesn't exist yet - BucketInfo bucketInfo = BucketInfo.newBuilder(configuration.getBucketName()).build(); - bucket = storageClient.create(bucketInfo); - LOG.trace("Bucket [{}] has been created", bucket.getName()); + LOG.info("getting the bucket {}", configuration.getBucketName()); + try { + + Bucket bucket = this.storageClient.get(configuration.getBucketName()); + if (bucket != null) { + LOG.trace("Bucket [{}] already exists", bucket.getName()); + return; + } else { + // creates the new bucket because it doesn't exist yet + BucketInfo bucketInfo = BucketInfo.newBuilder(configuration.getBucketName()).build(); + bucket = storageClient.create(bucketInfo); + LOG.trace("Bucket [{}] has been created", bucket.getName()); + } + } catch (Exception e) { + LOG.error("Error - autocreatebucket", e); + throw e; } } } diff --git a/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/client/StorageInternalClient.java b/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/client/StorageInternalClient.java deleted file mode 100644 index 5cdf745..0000000 --- a/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/client/StorageInternalClient.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.apache.camel.component.google.storage.client; - -import com.google.cloud.storage.Storage; - -public interface StorageInternalClient { - Storage getGoogleCloudStorage(); -} diff --git a/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/client/StorageInternalClientFactory.java b/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/client/StorageInternalClientFactory.java deleted file mode 100644 index 9f97d4c..0000000 --- a/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/client/StorageInternalClientFactory.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.apache.camel.component.google.storage.client; - -import org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration; - -public class StorageInternalClientFactory { - - public static StorageInternalClient getStorageClient(GoogleCloudStorageComponentConfiguration conf) { - return new StorageInternalClientImpl(conf); - } - -} diff --git a/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/client/StorageInternalClientImpl.java b/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/client/StorageInternalClientImpl.java deleted file mode 100644 index f3a8320..0000000 --- a/components/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/client/StorageInternalClientImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.apache.camel.component.google.storage.client; - -import java.io.FileInputStream; - -import com.google.auth.oauth2.ServiceAccountCredentials; -import com.google.cloud.storage.Storage; -import com.google.cloud.storage.StorageOptions; -import org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class StorageInternalClientImpl implements StorageInternalClient { - - private final static Logger LOGGER = LoggerFactory.getLogger(StorageInternalClientImpl.class); - - private GoogleCloudStorageComponentConfiguration configuration; - - public StorageInternalClientImpl(GoogleCloudStorageComponentConfiguration configuration) { - this.configuration = configuration; - } - - @Override - public Storage getGoogleCloudStorage() { - - try { - LOGGER.info("creating GoogleCloudStorage client using aplicationCredentials: {}", - configuration.getServiceAccountCredentials()); - FileInputStream serviceAccountCrediantialsFIS = new FileInputStream(configuration.getServiceAccountCredentials()); - - Storage storage = StorageOptions.newBuilder() - .setCredentials(ServiceAccountCredentials.fromStream(serviceAccountCrediantialsFIS)) - // .setProjectId(projectId) - .build().getService(); - - return storage; - - } catch (Exception e) { - e.printStackTrace(); - return null; - } - - } - -} diff --git a/components/camel-google-storage/src/test/java/org/apache/camel/component/google/storage/integration/ConsumerIntegrationTest.java b/components/camel-google-storage/src/test/java/org/apache/camel/component/google/storage/integration/ConsumerIntegrationTest.java new file mode 100644 index 0000000..5d19daf --- /dev/null +++ b/components/camel-google-storage/src/test/java/org/apache/camel/component/google/storage/integration/ConsumerIntegrationTest.java @@ -0,0 +1,93 @@ +package org.apache.camel.component.google.storage.integration; + +import org.apache.camel.EndpointInject; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.google.storage.GoogleCloudStorageConstants; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.Test; + +public class ConsumerIntegrationTest extends CamelTestSupport { + + @EndpointInject + private ProducerTemplate template; + + @EndpointInject("mock:result") + private MockEndpoint result; + + @EndpointInject("mock:consumedObjects") + private MockEndpoint consumedObjects; + + private final String bucketName = "rafa_test_bucket"; + final String serviceAccountKey = "C:\\Users\\rmarc\\Desktop\\LABS\\GCP_Storage\\FunctionExampleProject-c59c4a999d8a.json"; + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + + String endpoint = String.format("google-storage://%s?serviceAccountKey=%s&autoCreateBucket=true", bucketName, + serviceAccountKey); + //String endpoint = String.format("google-storage://%s?autoCreateBucket=true", bucketName); + + from("direct:putObject") + .startupOrder(1) + .to(endpoint) + .to("mock:result"); + + from("google-storage://myCamelBucket?" + + "moveAfterRead=true" + + "&destinationBucket=camelDestinationBucket" + + "&autoCreateBucket=true" + + "&deleteAfterRead=true" + + "&includeBody=true") + .startupOrder(2) + .log("consuming: ${header.CamelGoogleCloudStorageBucketName}/${header.CamelGoogleCloudStorageObjectName}, body=${body}") + .to("mock:consumedObjects"); + + } + }; + } + + @Test + public void sendIn() throws Exception { + result.expectedMessageCount(3); + consumedObjects.expectedMessageCount(3); + + //upload a files + + template.send("direct:putObject", exchange -> { + exchange.getIn().setHeader(GoogleCloudStorageConstants.OBJECT_NAME, "test.txt"); + exchange.getIn().setBody("Test"); + }); + + template.send("direct:putObject", exchange -> { + exchange.getIn().setHeader(GoogleCloudStorageConstants.OBJECT_NAME, "test1.txt"); + exchange.getIn().setBody("Test1"); + }); + + template.send("direct:putObject", exchange -> { + exchange.getIn().setHeader(GoogleCloudStorageConstants.OBJECT_NAME, "test2.txt"); + exchange.getIn().setBody("Test2"); + }); + /* + Exchange listBucketsExchange = template.request("direct:listBucket", exchange -> { + // exchange.getIn().setHeader(GoogleCloudStorageConstants.BUCKET_NAME, "myBucket"); not needed + exchange.getIn().setHeader(GoogleCloudStorageConstants.OPERATION, GoogleCloudStorageComponentOperations.listBuckets); + }); + List<Bucket> bucketsList = listBucketsExchange.getMessage().getBody(List.class); + LOG.info("bucketsList {}", bucketsList ); + + + Exchange listObjectsExchange = template.request("direct:listObjects", exchange -> { + exchange.getIn().setHeader(GoogleCloudStorageConstants.OPERATION, GoogleCloudStorageComponentOperations.listObjects); + }); + LOG.info("listObjectsExchange.body={}", listObjectsExchange.getMessage().getBody()); + */ + Thread.sleep(10000); + assertMockEndpointsSatisfied(); + } + +} diff --git a/components/camel-google-storage/src/test/java/org/apache/camel/component/google/storage/integration/ProducerIntegrationTest.java b/components/camel-google-storage/src/test/java/org/apache/camel/component/google/storage/integration/ProducerIntegrationTest.java new file mode 100644 index 0000000..2c76f0b --- /dev/null +++ b/components/camel-google-storage/src/test/java/org/apache/camel/component/google/storage/integration/ProducerIntegrationTest.java @@ -0,0 +1,141 @@ +package org.apache.camel.component.google.storage.integration; + +import java.io.ByteArrayInputStream; +import java.util.List; + +import com.google.cloud.storage.Blob; +import com.google.cloud.storage.Bucket; +import org.apache.camel.EndpointInject; +import org.apache.camel.Exchange; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.google.storage.GoogleCloudStorageComponentOperations; +import org.apache.camel.component.google.storage.GoogleCloudStorageConstants; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +public class ProducerIntegrationTest extends CamelTestSupport { + + private static final Logger LOG = LoggerFactory.getLogger(ProducerIntegrationTest.class); + + @EndpointInject + private ProducerTemplate template; + + @EndpointInject("mock:result") + private MockEndpoint result; + + private final String bucketName = "rafa_test_bucket"; + final String serviceAccountKey = "C:\\Users\\rmarc\\Desktop\\LABS\\GCP_Storage\\FunctionExampleProject-c59c4a999d8a.json"; + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + public void configure() { + + String endpoint = String.format("google-storage://%s?serviceAccountKey=%s&autoCreateBucket=true", bucketName, + serviceAccountKey); + //String endpoint = String.format("google-storage://%s?autoCreateBucket=true", bucketName); + + from("direct:addObject").to(endpoint); + from("direct:getObject").to(endpoint); + from("direct:listBucket").log("-> ${body}").to(endpoint).log("--> ${body}"); + from("direct:listObjects").to(endpoint).log("--> ${body}"); + from("direct:downloadLink").to(endpoint); + from("direct:deleteObject").to(endpoint); + from("direct:deleteBucket").to(endpoint).to("mock:result"); + + } + }; + } + + @SuppressWarnings("unchecked") + @Test + public void sendIn() throws Exception { + LOG.info("start sending something"); + result.expectedMessageCount(1); + + final String FILENAME_1 = "just_a_file.txt"; + + //upload a file + byte[] payload = "Hi, How are you ?".getBytes(); + ByteArrayInputStream bais = new ByteArrayInputStream(payload); + Exchange addObjectExchange = template.request("direct:addObject", exchange -> { + exchange.getIn().setHeader(GoogleCloudStorageConstants.OBJECT_NAME, FILENAME_1); + exchange.getIn().setHeader(GoogleCloudStorageConstants.CONTENT_ENCODING, "text/plain"); + exchange.getIn().setBody(bais); + }); + Blob addObject = addObjectExchange.getMessage().getBody(Blob.class); + LOG.info("addObject {}", addObject); + assertNotNull(addObject); + assertEquals(FILENAME_1, addObject.getName()); + + Exchange listBucketsExchange = template.request("direct:listBucket", exchange -> { + exchange.getIn().setHeader(GoogleCloudStorageConstants.OPERATION, + GoogleCloudStorageComponentOperations.listBuckets); + }); + List<Bucket> bucketsList = listBucketsExchange.getMessage().getBody(List.class); + LOG.info("bucketsList {}", bucketsList); + assertEquals(1, bucketsList.size()); + + Exchange listObjectsExchange = template.request("direct:listObjects", exchange -> { + // exchange.getIn().setHeader(GoogleCloudStorageConstants.BUCKET_NAME, "myBucket"); not needed + exchange.getIn().setHeader(GoogleCloudStorageConstants.OPERATION, + GoogleCloudStorageComponentOperations.listObjects); + }); + LOG.info("listObjectsExchange.body={}", listObjectsExchange.getMessage().getBody()); + List<Blob> resp = listObjectsExchange.getMessage().getBody(List.class); + assertEquals(1, resp.size()); + assertEquals(FILENAME_1, resp.get(0).getName()); + /* + Exchange getObjectExchange = template.request("direct:getObject", exchange -> { + exchange.getIn().setHeader(GoogleCloudStorageConstants.OPERATION, + GoogleCloudStorageComponentOperations.getObject); + // exchange.getIn().setHeader(GoogleCloudStorageConstants.BUCKET_NAME, "myBucket"); not needed + exchange.getIn().setHeader(GoogleCloudStorageConstants.OBJECT_NAME, FILENAME_1); + }); + Blob getObject = getObjectExchange.getMessage().getBody(Blob.class); + LOG.info("getObject: {}", getObject); + assertNotNull(getObject); + assertEquals(FILENAME_1, getObject.getName()); + + /* + //sign url + Exchange downloadLinkExchange = template.request( "direct:downloadLink", exchange -> { + exchange.getIn().setHeader(GoogleCloudStorageConstants.OPERATION, GoogleCloudStorageComponentOperations.createDownloadLink); + exchange.getIn().setHeader(GoogleCloudStorageConstants.OBJECT_NAME, "readme.txt" ); + exchange.getIn().setHeader(GoogleCloudStorageConstants.DOWNLOAD_LINK_EXPIRATION_TIME, 86400000L); //1 day + }); + URL downloadLink = downloadLinkExchange.getMessage().getBody(URL.class); + LOG.info("downloadLink {}", downloadLink ); + assertNotNull( downloadLink ); + */ + /* + Exchange deleteObjectExchange = template.send("direct:deleteObject", exchange -> { + exchange.getIn().setHeader(GoogleCloudStorageConstants.OPERATION, + GoogleCloudStorageComponentOperations.deleteObject); + exchange.getIn().setHeader(GoogleCloudStorageConstants.OBJECT_NAME, FILENAME_1); + }); + + boolean deleteObject = deleteObjectExchange.getMessage().getBody(Boolean.class).booleanValue(); + LOG.info("deleteObject {}", deleteObject); + assertTrue(deleteObject); + + Exchange deleteBucketExchange = template.send("direct:deleteBucket", exchange -> { + exchange.getIn().setHeader(GoogleCloudStorageConstants.OPERATION, + GoogleCloudStorageComponentOperations.deleteBucket); + }); + boolean deleteBucket = deleteBucketExchange.getMessage().getBody(Boolean.class).booleanValue(); + LOG.info("deleteBucket {}", deleteBucket); + assertTrue(deleteBucket); + + assertMockEndpointsSatisfied(); + */ + } + +} diff --git a/components/camel-google-storage/src/test/java/org/apache/camel/component/google/storage/localstorage/FakeStorageRpc.java b/components/camel-google-storage/src/test/java/org/apache/camel/component/google/storage/localstorage/FakeStorageRpc.java index 0933dd9..9a7cda6 100644 --- a/components/camel-google-storage/src/test/java/org/apache/camel/component/google/storage/localstorage/FakeStorageRpc.java +++ b/components/camel-google-storage/src/test/java/org/apache/camel/component/google/storage/localstorage/FakeStorageRpc.java @@ -120,8 +120,8 @@ class FakeStorageRpc extends StorageRpcTestBase { public Tuple<String, Iterable<Bucket>> list(Map<Option, ?> options) { String pageToken = null; String preprefix = ""; - String delimiter = null; - long maxResults = Long.MAX_VALUE; + //String delimiter = null; + //long maxResults = Long.MAX_VALUE; for (Map.Entry<Option, ?> e : options.entrySet()) { switch (e.getKey()) { case PAGE_TOKEN: @@ -134,13 +134,13 @@ class FakeStorageRpc extends StorageRpcTestBase { } break; case DELIMITER: - delimiter = (String) e.getValue(); + //delimiter = (String) e.getValue(); break; case FIELDS: // ignore and return all the fields break; case MAX_RESULTS: - maxResults = (Long) e.getValue(); + //maxResults = (Long) e.getValue(); break; case USER_PROJECT: // prevent unsupported operation diff --git a/components/camel-google-storage/src/test/java/org/apache/camel/component/google/storage/unit/GoogleCloudStorageComponentConfigurationTest.java b/components/camel-google-storage/src/test/java/org/apache/camel/component/google/storage/unit/GoogleCloudStorageComponentConfigurationTest.java index 73e5c89..6bcee9c 100644 --- a/components/camel-google-storage/src/test/java/org/apache/camel/component/google/storage/unit/GoogleCloudStorageComponentConfigurationTest.java +++ b/components/camel-google-storage/src/test/java/org/apache/camel/component/google/storage/unit/GoogleCloudStorageComponentConfigurationTest.java @@ -13,20 +13,20 @@ public class GoogleCloudStorageComponentConfigurationTest extends CamelTestSuppo @Test public void createEndpointWithMinimalConfiguration() throws Exception { final String bucketName = "myCamelBucket"; - final String serviceAccountCredentialsFile = "somefile.json"; + final String serviceAccountKeyFile = "somefile.json"; GoogleCloudStorageComponent component = context.getComponent("google-storage", GoogleCloudStorageComponent.class); GoogleCloudStorageEndpoint endpoint = (GoogleCloudStorageEndpoint) component.createEndpoint( - String.format("google-storage://%s?serviceAccountCredentials=%s", bucketName, serviceAccountCredentialsFile)); + String.format("google-storage://%s?serviceAccountKey=%s", bucketName, serviceAccountKeyFile)); assertEquals(endpoint.getConfiguration().getBucketName(), bucketName); - assertEquals(endpoint.getConfiguration().getServiceAccountCredentials(), serviceAccountCredentialsFile); + assertEquals(endpoint.getConfiguration().getServiceAccountKey(), serviceAccountKeyFile); } public void createEndpointForComplexConsumer() throws Exception { final String bucketName = "sourceCamelBucket"; - final String serviceAccountCredentialsFile = "somefile.json"; + final String serviceAccountKeyFile = "somefile.json"; final boolean moveAfterRead = false; final String destinationBucket = "destinationCamelBucket"; final boolean autoCreateBucket = true; @@ -36,13 +36,13 @@ public class GoogleCloudStorageComponentConfigurationTest extends CamelTestSuppo GoogleCloudStorageComponent component = context.getComponent("google-storage", GoogleCloudStorageComponent.class); GoogleCloudStorageEndpoint endpoint = (GoogleCloudStorageEndpoint) component.createEndpoint( String.format( - "google-storage://%s?serviceAccountCredentials=%s&moveAfterRead=%s&destinationBucket=%s&autoCreateBucket=%s&deleteAfterRead=%s&includeBody=%s", - bucketName, serviceAccountCredentialsFile, moveAfterRead, destinationBucket, autoCreateBucket, + "google-storage://%s?serviceAccountKey=%s&moveAfterRead=%s&destinationBucket=%s&autoCreateBucket=%s&deleteAfterRead=%s&includeBody=%s", + bucketName, serviceAccountKeyFile, moveAfterRead, destinationBucket, autoCreateBucket, deleteAfterRead, includeBody)); GoogleCloudStorageComponentConfiguration configuration = endpoint.getConfiguration(); assertEquals(configuration.getBucketName(), bucketName); - assertEquals(configuration.getServiceAccountCredentials(), serviceAccountCredentialsFile); + assertEquals(configuration.getServiceAccountKey(), serviceAccountKeyFile); assertEquals(configuration.isMoveAfterRead(), moveAfterRead); assertEquals(configuration.getDestinationBucket(), destinationBucket); assertEquals(configuration.isAutoCreateBucket(), autoCreateBucket); diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GoogleStorageComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GoogleStorageComponentBuilderFactory.java index 72ce762..e717385 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GoogleStorageComponentBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GoogleStorageComponentBuilderFactory.java @@ -100,18 +100,18 @@ public interface GoogleStorageComponentBuilderFactory { return this; } /** - * Specify the service account credentials file (json). + * Service account key. * * The option is a: <code>java.lang.String</code> type. * * Group: common * - * @param serviceAccountCredentials the value to set + * @param serviceAccountKey the value to set * @return the dsl builder */ - default GoogleStorageComponentBuilder serviceAccountCredentials( - java.lang.String serviceAccountCredentials) { - doSetProperty("serviceAccountCredentials", serviceAccountCredentials); + default GoogleStorageComponentBuilder serviceAccountKey( + java.lang.String serviceAccountKey) { + doSetProperty("serviceAccountKey", serviceAccountKey); return this; } /** @@ -192,38 +192,6 @@ public interface GoogleStorageComponentBuilderFactory { return this; } /** - * Define the destination bucket prefix to use when an object must be - * moved and moveAfterRead is set to true. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: consumer - * - * @param destinationBucketPrefix the value to set - * @return the dsl builder - */ - default GoogleStorageComponentBuilder destinationBucketPrefix( - java.lang.String destinationBucketPrefix) { - doSetProperty("destinationBucketPrefix", destinationBucketPrefix); - return this; - } - /** - * Define the destination bucket suffix to use when an object must be - * moved and moveAfterRead is set to true. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: consumer - * - * @param destinationBucketSuffix the value to set - * @return the dsl builder - */ - default GoogleStorageComponentBuilder destinationBucketSuffix( - java.lang.String destinationBucketSuffix) { - doSetProperty("destinationBucketSuffix", destinationBucketSuffix); - return this; - } - /** * If it is true, the S3Object exchange will be consumed and put into * the body and closed. If false the S3Object stream will be put raw * into the body and the headers will be set with the S3 object @@ -248,24 +216,6 @@ public interface GoogleStorageComponentBuilderFactory { return this; } /** - * If it is true, the folders/directories will be consumed. If it is - * false, they will be ignored, and Exchanges will not be created for - * those. - * - * The option is a: <code>boolean</code> type. - * - * Default: true - * Group: consumer - * - * @param includeFolders the value to set - * @return the dsl builder - */ - default GoogleStorageComponentBuilder includeFolders( - boolean includeFolders) { - doSetProperty("includeFolders", includeFolders); - return this; - } - /** * Move objects from S3 bucket to a different bucket after they have * been retrieved. To accomplish the operation the destinationBucket * option must be set. The copy bucket operation is only performed if @@ -373,15 +323,12 @@ public interface GoogleStorageComponentBuilderFactory { case "autoCreateBucket": getOrCreateConfiguration((GoogleCloudStorageComponent) component).setAutoCreateBucket((boolean) value); return true; case "configuration": ((GoogleCloudStorageComponent) component).setConfiguration((org.apache.camel.component.google.storage.GoogleCloudStorageComponentConfiguration) value); return true; case "objectName": getOrCreateConfiguration((GoogleCloudStorageComponent) component).setObjectName((java.lang.String) value); return true; - case "serviceAccountCredentials": getOrCreateConfiguration((GoogleCloudStorageComponent) component).setServiceAccountCredentials((java.lang.String) value); return true; + case "serviceAccountKey": getOrCreateConfiguration((GoogleCloudStorageComponent) component).setServiceAccountKey((java.lang.String) value); return true; case "storageClient": getOrCreateConfiguration((GoogleCloudStorageComponent) component).setStorageClient((com.google.cloud.storage.Storage) value); return true; case "bridgeErrorHandler": ((GoogleCloudStorageComponent) component).setBridgeErrorHandler((boolean) value); return true; case "deleteAfterRead": getOrCreateConfiguration((GoogleCloudStorageComponent) component).setDeleteAfterRead((boolean) value); return true; case "destinationBucket": getOrCreateConfiguration((GoogleCloudStorageComponent) component).setDestinationBucket((java.lang.String) value); return true; - case "destinationBucketPrefix": getOrCreateConfiguration((GoogleCloudStorageComponent) component).setDestinationBucketPrefix((java.lang.String) value); return true; - case "destinationBucketSuffix": getOrCreateConfiguration((GoogleCloudStorageComponent) component).setDestinationBucketSuffix((java.lang.String) value); return true; case "includeBody": getOrCreateConfiguration((GoogleCloudStorageComponent) component).setIncludeBody((boolean) value); return true; - case "includeFolders": getOrCreateConfiguration((GoogleCloudStorageComponent) component).setIncludeFolders((boolean) value); return true; case "moveAfterRead": getOrCreateConfiguration((GoogleCloudStorageComponent) component).setMoveAfterRead((boolean) value); return true; case "lazyStartProducer": ((GoogleCloudStorageComponent) component).setLazyStartProducer((boolean) value); return true; case "operation": getOrCreateConfiguration((GoogleCloudStorageComponent) component).setOperation((org.apache.camel.component.google.storage.GoogleCloudStorageComponentOperations) value); return true; diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GoogleCloudStorageEndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GoogleCloudStorageEndpointBuilderFactory.java index da762b7..42ceb8d 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GoogleCloudStorageEndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GoogleCloudStorageEndpointBuilderFactory.java @@ -96,18 +96,18 @@ public interface GoogleCloudStorageEndpointBuilderFactory { return this; } /** - * Specify the service account credentials file (json). + * Service account key. * * The option is a: <code>java.lang.String</code> type. * * Group: common * - * @param serviceAccountCredentials the value to set + * @param serviceAccountKey the value to set * @return the dsl builder */ - default GoogleCloudStorageEndpointConsumerBuilder serviceAccountCredentials( - String serviceAccountCredentials) { - doSetProperty("serviceAccountCredentials", serviceAccountCredentials); + default GoogleCloudStorageEndpointConsumerBuilder serviceAccountKey( + String serviceAccountKey) { + doSetProperty("serviceAccountKey", serviceAccountKey); return this; } /** @@ -251,38 +251,6 @@ public interface GoogleCloudStorageEndpointBuilderFactory { return this; } /** - * Define the destination bucket prefix to use when an object must be - * moved and moveAfterRead is set to true. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: consumer - * - * @param destinationBucketPrefix the value to set - * @return the dsl builder - */ - default GoogleCloudStorageEndpointConsumerBuilder destinationBucketPrefix( - String destinationBucketPrefix) { - doSetProperty("destinationBucketPrefix", destinationBucketPrefix); - return this; - } - /** - * Define the destination bucket suffix to use when an object must be - * moved and moveAfterRead is set to true. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: consumer - * - * @param destinationBucketSuffix the value to set - * @return the dsl builder - */ - default GoogleCloudStorageEndpointConsumerBuilder destinationBucketSuffix( - String destinationBucketSuffix) { - doSetProperty("destinationBucketSuffix", destinationBucketSuffix); - return this; - } - /** * If it is true, the S3Object exchange will be consumed and put into * the body and closed. If false the S3Object stream will be put raw * into the body and the headers will be set with the S3 object @@ -334,43 +302,6 @@ public interface GoogleCloudStorageEndpointBuilderFactory { return this; } /** - * If it is true, the folders/directories will be consumed. If it is - * false, they will be ignored, and Exchanges will not be created for - * those. - * - * The option is a: <code>boolean</code> type. - * - * Default: true - * Group: consumer - * - * @param includeFolders the value to set - * @return the dsl builder - */ - default GoogleCloudStorageEndpointConsumerBuilder includeFolders( - boolean includeFolders) { - doSetProperty("includeFolders", includeFolders); - return this; - } - /** - * If it is true, the folders/directories will be consumed. If it is - * false, they will be ignored, and Exchanges will not be created for - * those. - * - * The option will be converted to a <code>boolean</code> - * type. - * - * Default: true - * Group: consumer - * - * @param includeFolders the value to set - * @return the dsl builder - */ - default GoogleCloudStorageEndpointConsumerBuilder includeFolders( - String includeFolders) { - doSetProperty("includeFolders", includeFolders); - return this; - } - /** * Move objects from S3 bucket to a different bucket after they have * been retrieved. To accomplish the operation the destinationBucket * option must be set. The copy bucket operation is only performed if @@ -1111,18 +1042,18 @@ public interface GoogleCloudStorageEndpointBuilderFactory { return this; } /** - * Specify the service account credentials file (json). + * Service account key. * * The option is a: <code>java.lang.String</code> type. * * Group: common * - * @param serviceAccountCredentials the value to set + * @param serviceAccountKey the value to set * @return the dsl builder */ - default GoogleCloudStorageEndpointProducerBuilder serviceAccountCredentials( - String serviceAccountCredentials) { - doSetProperty("serviceAccountCredentials", serviceAccountCredentials); + default GoogleCloudStorageEndpointProducerBuilder serviceAccountKey( + String serviceAccountKey) { + doSetProperty("serviceAccountKey", serviceAccountKey); return this; } /** @@ -1309,18 +1240,18 @@ public interface GoogleCloudStorageEndpointBuilderFactory { return this; } /** - * Specify the service account credentials file (json). + * Service account key. * * The option is a: <code>java.lang.String</code> type. * * Group: common * - * @param serviceAccountCredentials the value to set + * @param serviceAccountKey the value to set * @return the dsl builder */ - default GoogleCloudStorageEndpointBuilder serviceAccountCredentials( - String serviceAccountCredentials) { - doSetProperty("serviceAccountCredentials", serviceAccountCredentials); + default GoogleCloudStorageEndpointBuilder serviceAccountKey( + String serviceAccountKey) { + doSetProperty("serviceAccountKey", serviceAccountKey); return this; } /** diff --git a/docs/components/modules/ROOT/pages/google-storage-component.adoc b/docs/components/modules/ROOT/pages/google-storage-component.adoc index ca3c088..96c2165 100644 --- a/docs/components/modules/ROOT/pages/google-storage-component.adoc +++ b/docs/components/modules/ROOT/pages/google-storage-component.adoc @@ -67,7 +67,7 @@ from("google-storage://myCamelBucket?serviceAccountCredentials=/home/user/Downlo == Options // component options: START -The Google Storage component supports 16 options, which are listed below. +The Google Storage component supports 13 options, which are listed below. @@ -77,18 +77,15 @@ The Google Storage component supports 16 options, which are listed below. | *autoCreateBucket* (common) | Setting the autocreation of the bucket bucketName. | true | boolean | *configuration* (common) | The component configuration | | GoogleCloudStorageComponentConfiguration | *objectName* (common) | objectName | | String -| *serviceAccountCredentials* (common) | Specify the service account credentials file (json) | | String +| *serviceAccountKey* (common) | Service account key | | String | *storageClient* (common) | Set strage client | | Storage | *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 | *deleteAfterRead* (consumer) | Delete objects from S3 after they have been retrieved. The delete is only performed if the Exchange is committed. If a rollback occurs, the object is not deleted. If this option is false, then the same objects will be retrieve over and over again on the polls. Therefore you need to use the Idempotent Consumer EIP in the route to filter out duplicates. You can filter using the AWS2S3Constants#BUCKET_NAME and AWS2S3Constants#KEY headers, or only the AWS2S3C [...] | *destinationBucket* (consumer) | Define the destination bucket where an object must be moved when moveAfterRead is set to true. | | String -| *destinationBucketPrefix* (consumer) | Define the destination bucket prefix to use when an object must be moved and moveAfterRead is set to true. | | String -| *destinationBucketSuffix* (consumer) | Define the destination bucket suffix to use when an object must be moved and moveAfterRead is set to true. | | String | *includeBody* (consumer) | If it is true, the S3Object exchange will be consumed and put into the body and closed. If false the S3Object stream will be put raw into the body and the headers will be set with the S3 object metadata. This option is strongly related to autocloseBody option. In case of setting includeBody to true because the S3Object stream will be consumed then it will also be closed in case of includeBody false then it will be up to the caller to close the S3Object stream [...] -| *includeFolders* (consumer) | If it is true, the folders/directories will be consumed. If it is false, they will be ignored, and Exchanges will not be created for those | true | boolean | *moveAfterRead* (consumer) | Move objects from S3 bucket to a different bucket after they have been retrieved. To accomplish the operation the destinationBucket option must be set. The copy bucket operation is only performed if the Exchange is committed. If a rollback occurs, the object is not moved. | false | boolean | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] -| *operation* (producer) | set the operation for the producer. There are 7 enums and the value can be one of: copyObject, listObjects, deleteObject, deleteBucket, listBuckets, getObject, getObjectRange | | GoogleCloudStorageComponentOperations +| *operation* (producer) | set the operation for the producer. There are 7 enums and the value can be one of: copyObject, listObjects, deleteObject, deleteBucket, listBuckets, getObject, createDownloadLink | | GoogleCloudStorageComponentOperations | *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean |=== // component options: END @@ -112,7 +109,7 @@ with the following path and query parameters: |=== -=== Query Parameters (32 parameters): +=== Query Parameters (29 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -120,22 +117,19 @@ with the following path and query parameters: | Name | Description | Default | Type | *autoCreateBucket* (common) | Setting the autocreation of the bucket bucketName. | true | boolean | *objectName* (common) | objectName | | String -| *serviceAccountCredentials* (common) | Specify the service account credentials file (json) | | String +| *serviceAccountKey* (common) | Service account key | | String | *storageClient* (common) | Set strage client | | Storage | *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 | *deleteAfterRead* (consumer) | Delete objects from S3 after they have been retrieved. The delete is only performed if the Exchange is committed. If a rollback occurs, the object is not deleted. If this option is false, then the same objects will be retrieve over and over again on the polls. Therefore you need to use the Idempotent Consumer EIP in the route to filter out duplicates. You can filter using the AWS2S3Constants#BUCKET_NAME and AWS2S3Constants#KEY headers, or only the AWS2S3C [...] | *destinationBucket* (consumer) | Define the destination bucket where an object must be moved when moveAfterRead is set to true. | | String -| *destinationBucketPrefix* (consumer) | Define the destination bucket prefix to use when an object must be moved and moveAfterRead is set to true. | | String -| *destinationBucketSuffix* (consumer) | Define the destination bucket suffix to use when an object must be moved and moveAfterRead is set to true. | | String | *includeBody* (consumer) | If it is true, the S3Object exchange will be consumed and put into the body and closed. If false the S3Object stream will be put raw into the body and the headers will be set with the S3 object metadata. This option is strongly related to autocloseBody option. In case of setting includeBody to true because the S3Object stream will be consumed then it will also be closed in case of includeBody false then it will be up to the caller to close the S3Object stream [...] -| *includeFolders* (consumer) | If it is true, the folders/directories will be consumed. If it is false, they will be ignored, and Exchanges will not be created for those | true | boolean | *moveAfterRead* (consumer) | Move objects from S3 bucket to a different bucket after they have been retrieved. To accomplish the operation the destinationBucket option must be set. The copy bucket operation is only performed if the Exchange is committed. If a rollback occurs, the object is not moved. | false | boolean | *sendEmptyMessageWhenIdle* (consumer) | If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead. | false | boolean | *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | | ExceptionHandler | *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. There are 3 enums and the value can be one of: InOnly, InOut, InOptionalOut | | ExchangePattern | *pollStrategy* (consumer) | A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel. | | PollingConsumerPollStrategy | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] -| *operation* (producer) | set the operation for the producer. There are 7 enums and the value can be one of: copyObject, listObjects, deleteObject, deleteBucket, listBuckets, getObject, getObjectRange | | GoogleCloudStorageComponentOperations +| *operation* (producer) | set the operation for the producer. There are 7 enums and the value can be one of: copyObject, listObjects, deleteObject, deleteBucket, listBuckets, getObject, createDownloadLink | | GoogleCloudStorageComponentOperations | *backoffErrorThreshold* (scheduler) | The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in. | | int | *backoffIdleThreshold* (scheduler) | The number of subsequent idle polls that should happen before the backoffMultipler should kick-in. | | int | *backoffMultiplier* (scheduler) | To let the scheduled polling consumer backoff if there has been a number of subsequent idles/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening again. When this option is in use then backoffIdleThreshold and/or backoffErrorThreshold must also be configured. | | int