Camel Spring Boot

Google Storage

Store and retrieve objects from Google Cloud Storage Service using the google-cloud-storage library.

What’s inside

Please refer to the above links for usage and configuration details.

Maven coordinates

<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-google-storage-starter</artifactId>
</dependency>

Spring Boot Auto-Configuration

The starter supports 26 options, which are listed below.

Name Description Default Type

camel.component.google-storage.auto-create-bucket

Whether to create a bucket that does not exist, in the storageLocation and with the storageClass. The endpoint checks its bucket when it starts, the consumer checks the destinationBucket of moveAfterRead when it starts, and the producer checks the destination bucket of each copyObject. When false, a missing bucket makes the calls fail.

true

Boolean

camel.component.google-storage.autowired-enabled

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

camel.component.google-storage.bridge-error-handler

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. 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

camel.component.google-storage.configuration

The component configuration. The option is a org.apache.camel.component.google.storage.GoogleCloudStorageConfiguration type.

GoogleCloudStorageConfiguration

camel.component.google-storage.delete-after-read

Whether to delete each consumed object from the bucket after its exchange completed successfully. When the exchange fails, the object is not deleted and a later poll consumes it again. When false, the objects stay in the bucket and every poll consumes them again.

true

Boolean

camel.component.google-storage.destination-bucket

The bucket that moveAfterRead copies the consumed objects to. Required when moveAfterRead is enabled. When it does not exist, the consumer creates it at start if autoCreateBucket is enabled.

String

camel.component.google-storage.download-file-name

Downloads the content of each consumed object to a local file, whose java.io.File is the message body, instead of into memory. A value without $\{…​} is a directory, and the file is the object name in it: mydownload is the same as mydownload/$\{file:name}. A value with $\{…​} is a file language expression in which $\{file:name} is the object name, such as $\{date:now:yyyyMMdd}/$\{file:name}. The consumer does not create directories: the parent directory of the file must exist. An object name that is absolute or has a .. segment is rejected, as is a file outside the directory before the first $\{…​} (the working directory when there is none). Used only when includeBody is enabled.

String

camel.component.google-storage.enabled

Whether to enable auto configuration of the google-storage component. This is enabled by default.

Boolean

camel.component.google-storage.filter

A regular expression that the whole name of an object must match for the consumer to consume it. Not used when objectName is set.

String

camel.component.google-storage.health-check-consumer-enabled

Used for enabling or disabling all consumer based health checks from this component

true

Boolean

camel.component.google-storage.health-check-producer-enabled

Used for enabling or disabling all producer based health checks from this component. Notice: Camel has by default disabled all producer based health-checks. You can turn on producer checks globally by setting camel.health.producersEnabled=true.

true

Boolean

camel.component.google-storage.impersonated-service-account

The email of a service account to impersonate with the credentials of Workload Identity Federation, so the workload gets the permissions of that service account. Used when useWorkloadIdentityFederation is enabled; the federated identity needs the Service Account Token Creator role on the service account.

String

camel.component.google-storage.include-body

Whether to download the content of the object into the message body. When false, the body is the Blob, which holds the metadata of the object and not its content. The headers with the metadata of the object are set in both cases.

true

Boolean

camel.component.google-storage.include-folders

Whether to consume the objects whose name ends with a slash (/), which stand for folders. When false, the consumer skips them.

true

Boolean

camel.component.google-storage.lazy-start-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 starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.google-storage.move-after-read

Whether to copy each consumed object, under the same name, to the destinationBucket after its exchange completed successfully. The object is removed from the bucket only when deleteAfterRead is enabled too (the default); otherwise it stays and a later poll consumes and copies it again. When the exchange fails, the object is not copied.

false

Boolean

camel.component.google-storage.object-name

The name of the object (Blob) in the bucket. The consumer then polls only this object instead of listing the bucket. The producer uses it as the object of the operation or of the upload, and it takes precedence over the CamelGoogleCloudStorageObjectName header.

String

camel.component.google-storage.object-storage-class

The Cloud Storage class of the objects that the producer uploads. When not set, an object gets the default storage class of its bucket. The CamelGoogleCloudStorageStorageClass header overrides it per message.

StorageClass

camel.component.google-storage.operation

The operation that the producer performs, when the CamelGoogleCloudStorageOperation header does not set one. When neither sets an operation, the producer uploads the message body as an object.

GoogleCloudStorageOperations

camel.component.google-storage.prefix

Consumes only the objects whose name starts with this prefix, which the consumer passes to the listing of the bucket as BlobListOption.prefix. Not used when objectName is set. The listObjects operation of the producer takes its prefix from the CamelGoogleCloudStoragePrefixName header instead.

String

camel.component.google-storage.service-account-key

The service account key file (JSON) used as the credentials of the Storage client. It is loaded as a resource: the classpath:, file:, http: or https: prefix says where from, and a value without a prefix is looked up on the classpath first and then in the file system. When not set, the Application Default Credentials are used, for example from the GOOGLE_APPLICATION_CREDENTIALS environment variable. Not used when useWorkloadIdentityFederation is enabled or when storageClient is set.

String

camel.component.google-storage.storage-class

The default storage class of the buckets that the component creates when autoCreateBucket is enabled. An object uploaded without a storage class of its own gets the storage class of its bucket. Not used for a bucket that already exists.

standard

StorageClass

camel.component.google-storage.storage-client

The Storage client to use. When not set, a single Storage in the registry is used, or else the endpoint creates one, with the credentials that serviceAccountKey and useWorkloadIdentityFederation describe. Those options are not used when a client is set. The option is a com.google.cloud.storage.Storage type.

Storage

camel.component.google-storage.storage-location

The location, such as US, EU or US-EAST1, of the buckets that the component creates when autoCreateBucket is enabled. Not used for a bucket that already exists.

US-EAST1

String

camel.component.google-storage.use-workload-identity-federation

Whether to authenticate with Workload Identity Federation instead of a service account key: with the credential configuration file given in workloadIdentityConfig or, when it is not set, with the Application Default Credentials, which detect Workload Identity on GKE.

false

Boolean

camel.component.google-storage.workload-identity-config

The Workload Identity Federation credential configuration file (JSON, of type external_account), which says how to exchange a token of an external identity provider, such as AWS, Azure or an OIDC provider, for Google credentials. Used when useWorkloadIdentityFederation is enabled. It is loaded as a resource: the classpath:, file:, http: or https: prefix says where from, and a value without a prefix is looked up on the classpath first and then in the file system.

String