Azure Storage Data Lake Service
Since Camel 3.8
Both producer and consumer are supported
The Azure storage datalake component is used for storing and retrieving file from Azure Storage Data Lake Service using the Azure APIs v12.
Prerequisites
You need to have a valid Azure account with Azure storage set up. More information can be found at Azure Documentation Portal.
Maven users will need to add the following dependency to their pom.xml for this component.
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-azure-storage-datalake</artifactId>
<version>x.x.x</version>
<!-- use the same version as your camel core version -->
</dependency> Uri Format
azure-storage-datalake:accountName[/fileSystemName][?options] In the case of the consumer, both accountName and fileSystemName are required. In the case of the producer, it depends on the operation being requested.
You can append query options to the URI in the following format: ?option1=value&option2=value&…
Configuring Options
Camel components are configured on two separate levels:
-
component level
-
endpoint level
Configuring Component Options
At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.
For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.
Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.
You can configure components using:
-
the Component DSL.
-
in a configuration file (
application.properties,*.yamlfiles, etc). -
directly in the Java code.
Configuring Endpoint Options
You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.
Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.
A good practice when configuring options is to use Property Placeholders.
Property placeholders provide a few benefits:
-
They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.
-
They allow externalizing the configuration from the code.
-
They help the code to become more flexible and reusable.
The following two sections list all the options, firstly for the component followed by the endpoint.
Component Options
The Azure Storage Data Lake Service component supports the following options which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
The client ID of the Microsoft Entra ID application, which authenticates the client together with clientSecret and tenantId when credentialType is CLIENT_SECRET. Not used when clientSecretCredential or serviceClient is set. | String | ||
Whether the file changed event that flushToFile raises, when Azure Storage events are enabled, tells that the file is complete (true) or that it was modified (false). The CamelAzureStorageDataLakeClose header replaces this option. | false | Boolean | |
Whether getFile closes the OutputStream body that it writes the file into, once the download is done. If false, the route must close it. | true | Boolean | |
The configuration that each endpoint of this component starts from, before the options of the endpoint are applied. | DataLakeConfiguration | ||
How the client authenticates. CLIENT_SECRET uses clientSecretCredential, or clientId, clientSecret and tenantId. SHARED_KEY_CREDENTIAL uses sharedKeyCredential, or accountName and accountKey. AZURE_IDENTITY uses the default Azure credential, which tries environment variables, workload identity, managed identity, the Azure CLI and other sources, in the tenant of tenantId if set. AZURE_SAS uses sasCredential or sasSignature. SERVICE_CLIENT_INSTANCE uses serviceClient. If not set, it follows the credential object that is set: sharedKeyCredential, sasCredential or clientSecretCredential, in this order, and otherwise CLIENT_SECRET. Not used when serviceClient is set. Enum values:
| CLIENT_SECRET | CredentialType | |
The number of bytes to read from fileOffset, for the consumer, getFile and downloadToFile. Only used when fileOffset is set too; otherwise the whole file is read. The CamelAzureStorageDataLakeFileRange header replaces both options for the producer. | Long | ||
The path of a directory in the file system, which createFile creates the file in and deleteDirectory deletes. The CamelAzureStorageDataLakeDirectoryName header replaces this option. The other operations and the consumer do not use it: for them, fileName is the whole path of the file. | String | ||
How long, in milliseconds, the link that downloadLink generates stays valid. It is rounded down to whole seconds. If not set, the link is valid for 1 hour. The link holds a service SAS with read permission, which the client can only sign with a shared key (SHARED_KEY_CREDENTIAL). The CamelAzureStorageDataLakeDownloadLinkExpiration header replaces this option. | Long | ||
The query expression of openQueryInputStream, in the SQL-like syntax of query acceleration, for example SELECT * from BlobStorage. Required for openQueryInputStream unless the CamelAzureStorageDataLakeQueryOptions header is set. The CamelAzureStorageDataLakeExpression header replaces this option. | String | ||
The local directory to download files into. When it is set, the consumer downloads each file into this directory, and the body is that java.io.File instead of a stream, with the properties of the file in headers. downloadToFile requires it, and the CamelAzureStorageDataLakeFileDir header replaces it. The local file is named after the last segment of the path of the file, and a local file that already exists is replaced. | String | ||
The path of the file in the file system, such as dir/file.txt. With it, the consumer reads only this file, at each poll, and without it the consumer reads the files that the path option lists. The producer requires it for the operations on a file, and for createFile it is the name of the file to create in directoryName. The CamelAzureStorageDataLakeFileName header replaces this option for the producer. | String | ||
A position in bytes in the file. For appendToFile, the position at which the appended data starts; if not set, the current committed length of the file, and the CamelAzureStorageDataLakeFileOffset header replaces it. Together with dataCount, the position of the first byte to read, for the consumer, getFile and downloadToFile. | Long | ||
The number of paths per page, at most 5000, that the service returns when the consumer or listPaths list paths. The consumer and listPaths still get the paths of all pages. If not set, the value is 1000. The CamelAzureStorageDataLakeMaxResults header replaces this option for the producer. | Integer | ||
How many more times the Azure SDK requests the rest of the file, from where it stopped, when reading the content of a download fails: for getFile with an OutputStream body, downloadToFile and the consumer with fileDir. The default 0 turns these retries off, rather than the 5 retries of the SDK. Must be 0 or more. | int | ||
The java.nio.file.OpenOption set that opens or creates the local file that downloadToFile and the consumer with fileDir write into. If not set, CREATE_NEW, READ and WRITE. The CamelAzureStorageDataLakeOpenOptions header replaces this option for the producer. | Set | ||
The path of the directory whose paths the consumer and listPaths list, relative to the root of the file system. The listing fails if the path does not exist. For uploadFromFile, it is instead the path of the local file to upload. The CamelAzureStorageDataLakePath header replaces this option for the producer. | String | ||
The POSIX access permissions of the file that createFile and upload create, for the owner, the owning group and others, in symbolic (rwxr-x---) or 4-digit octal (0750) notation. Only for an account with a hierarchical namespace. The CamelAzureStorageDataLakePermission header replaces this option. | String | ||
The length in bytes of the file once flushToFile has committed the appended data, including the data committed before. If not set, the current committed length of the file, which commits no newly appended data. The CamelAzureStorageDataLakePosition header replaces this option. | Long | ||
Whether the consumer and listPaths also list the paths in the subdirectories of path, at all levels. If false, they list only the direct children of path. For deleteDirectory, whether to delete the directory with all its content: if false, the directory must be empty. The CamelAzureStorageDataLakeRecursive header replaces this option for the producer. | false | Boolean | |
A Java regular expression that the whole path of a listed file or directory must match, for example .*\.csv, for the consumer to read it or for listPaths to return it. The paths are filtered after they are listed. The CamelAzureStorageDataLakeRegex header replaces this option for the producer. | String | ||
Whether flushToFile keeps the appended data beyond position that it does not commit. If false, the service deletes that uncommitted data. The CamelAzureStorageDataLakeRetainCommitedData header replaces this option. | false | Boolean | |
Autowired To use a custom com.azure.storage.file.datalake.DataLakeServiceClient for the requests to the Data Lake Storage service. When this option is set or autowired, the client brings the address and the authentication, and credentialType and the other credential options are not used. | DataLakeServiceClient | ||
Autowired To use a com.azure.storage.common.StorageSharedKeyCredential, which holds the account name and an account key of the storage account, when credentialType is SHARED_KEY_CREDENTIAL. When it is set and credentialType is not, credentialType becomes SHARED_KEY_CREDENTIAL. Its account name gives the address of the service, and accountKey is not used. Not used when serviceClient is set. | StorageSharedKeyCredential | ||
The ID of the Microsoft Entra ID tenant: of the application of clientId and clientSecret when credentialType is CLIENT_SECRET, and the tenant that the default Azure credential authenticates in when credentialType is AZURE_IDENTITY. For CLIENT_SECRET, not used when clientSecretCredential is set. Not used when serviceClient is set. | String | ||
The time, for example PT30S or 30s, within which each call to the service must complete, or it fails with an exception. If not set, only the timeouts of the HTTP client apply. For listPaths, listFileSystem and the listing of the consumer, it applies to each page of the listing. It does not apply to reading a file as a stream (getFile without an OutputStream body, and the consumer without fileDir), to openQueryInputStream and to the delete of deleteAfterRead. The CamelAzureStorageDataLakeTimeout header replaces this option for the producer. | Duration | ||
The umask, in 4-digit octal notation such as 0027, that restricts the permissions of the file that createFile and upload create. Only for an account with a hierarchical namespace. The CamelAzureStorageDataLakeUmask header replaces this option. | String | ||
Whether listPaths returns the owner and group of each path as user principal names instead of Microsoft Entra ID object IDs. Only for an account with a hierarchical namespace. The CamelAzureStorageDataLakeUserPrincipalNameReturned header replaces this option. | false | Boolean | |
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 | |
Delete a file from the file system once its exchange has completed. When the exchange fails, the file is not deleted, so it is consumed again at the next poll. | false | boolean | |
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 | |
The operation that the producer performs. The CamelAzureStorageDataLakeOperation header replaces this option. Enum values:
| listFileSystem | DataLakeOperationsDefinition | |
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 | |
Used for enabling or disabling all consumer based health checks from this component. | true | boolean | |
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 | |
The account key of the storage account, which authenticates the client together with accountName when credentialType is SHARED_KEY_CREDENTIAL. Setting it does not change credentialType, which must be set. Not used when sharedKeyCredential or serviceClient is set. | String | ||
The client secret of the Microsoft Entra ID application, which authenticates the client together with clientId and tenantId when credentialType is CLIENT_SECRET. Not used when clientSecretCredential or serviceClient is set. | String | ||
Autowired To use a com.azure.identity.ClientSecretCredential, which authenticates with a client secret of a Microsoft Entra ID application, when credentialType is CLIENT_SECRET. When it is set, the clientId, clientSecret and tenantId options are not used. Not used when serviceClient is set. | ClientSecretCredential | ||
Autowired To use a com.azure.core.credential.AzureSasCredential, which holds a shared access signature (SAS) token, when credentialType is AZURE_SAS. When it is set and credentialType is not, credentialType becomes AZURE_SAS, unless sharedKeyCredential is set. When it is set, sasSignature is not used. Not used when serviceClient is set. | AzureSasCredential | ||
The shared access signature (SAS) token that authenticates the client when credentialType is AZURE_SAS. Setting it does not change credentialType, which must be set. Not used when sasCredential or serviceClient is set. | String |
Endpoint Options
The Azure Storage Data Lake Service endpoint is configured using URI syntax:
azure-storage-datalake:accountName/fileSystemName
With the following path and query parameters:
Path Parameters
| Name | Description | Default | Type |
|---|---|---|---|
The name of the Azure Storage account, which gives the address https://accountName.dfs.core.windows.net of its Data Lake Storage service. With SHARED_KEY_CREDENTIAL and accountKey, it is also the account name of the shared key. If the sharedKeyCredential option is set, the account name of that credential gives the address instead. Not used when serviceClient is set. | String | ||
The name of the file system. Required for the consumer and for each producer operation except listFileSystem. The CamelAzureStorageDataLakeFileSystemName header replaces this option for the producer. | String |
Query Parameters
| Name | Description | Default | Type |
|---|---|---|---|
The client ID of the Microsoft Entra ID application, which authenticates the client together with clientSecret and tenantId when credentialType is CLIENT_SECRET. Not used when clientSecretCredential or serviceClient is set. | String | ||
Whether the file changed event that flushToFile raises, when Azure Storage events are enabled, tells that the file is complete (true) or that it was modified (false). The CamelAzureStorageDataLakeClose header replaces this option. | false | Boolean | |
Whether getFile closes the OutputStream body that it writes the file into, once the download is done. If false, the route must close it. | true | Boolean | |
How the client authenticates. CLIENT_SECRET uses clientSecretCredential, or clientId, clientSecret and tenantId. SHARED_KEY_CREDENTIAL uses sharedKeyCredential, or accountName and accountKey. AZURE_IDENTITY uses the default Azure credential, which tries environment variables, workload identity, managed identity, the Azure CLI and other sources, in the tenant of tenantId if set. AZURE_SAS uses sasCredential or sasSignature. SERVICE_CLIENT_INSTANCE uses serviceClient. If not set, it follows the credential object that is set: sharedKeyCredential, sasCredential or clientSecretCredential, in this order, and otherwise CLIENT_SECRET. Not used when serviceClient is set. Enum values:
| CLIENT_SECRET | CredentialType | |
The number of bytes to read from fileOffset, for the consumer, getFile and downloadToFile. Only used when fileOffset is set too; otherwise the whole file is read. The CamelAzureStorageDataLakeFileRange header replaces both options for the producer. | Long | ||
Not used: when the endpoint starts, it replaces this client with the serviceClient option, or with a client that it creates from the other options. Use serviceClient to set the client. | DataLakeServiceClient | ||
The path of a directory in the file system, which createFile creates the file in and deleteDirectory deletes. The CamelAzureStorageDataLakeDirectoryName header replaces this option. The other operations and the consumer do not use it: for them, fileName is the whole path of the file. | String | ||
How long, in milliseconds, the link that downloadLink generates stays valid. It is rounded down to whole seconds. If not set, the link is valid for 1 hour. The link holds a service SAS with read permission, which the client can only sign with a shared key (SHARED_KEY_CREDENTIAL). The CamelAzureStorageDataLakeDownloadLinkExpiration header replaces this option. | Long | ||
The query expression of openQueryInputStream, in the SQL-like syntax of query acceleration, for example SELECT * from BlobStorage. Required for openQueryInputStream unless the CamelAzureStorageDataLakeQueryOptions header is set. The CamelAzureStorageDataLakeExpression header replaces this option. | String | ||
The local directory to download files into. When it is set, the consumer downloads each file into this directory, and the body is that java.io.File instead of a stream, with the properties of the file in headers. downloadToFile requires it, and the CamelAzureStorageDataLakeFileDir header replaces it. The local file is named after the last segment of the path of the file, and a local file that already exists is replaced. | String | ||
The path of the file in the file system, such as dir/file.txt. With it, the consumer reads only this file, at each poll, and without it the consumer reads the files that the path option lists. The producer requires it for the operations on a file, and for createFile it is the name of the file to create in directoryName. The CamelAzureStorageDataLakeFileName header replaces this option for the producer. | String | ||
A position in bytes in the file. For appendToFile, the position at which the appended data starts; if not set, the current committed length of the file, and the CamelAzureStorageDataLakeFileOffset header replaces it. Together with dataCount, the position of the first byte to read, for the consumer, getFile and downloadToFile. | Long | ||
The number of paths per page, at most 5000, that the service returns when the consumer or listPaths list paths. The consumer and listPaths still get the paths of all pages. If not set, the value is 1000. The CamelAzureStorageDataLakeMaxResults header replaces this option for the producer. | Integer | ||
How many more times the Azure SDK requests the rest of the file, from where it stopped, when reading the content of a download fails: for getFile with an OutputStream body, downloadToFile and the consumer with fileDir. The default 0 turns these retries off, rather than the 5 retries of the SDK. Must be 0 or more. | int | ||
The java.nio.file.OpenOption set that opens or creates the local file that downloadToFile and the consumer with fileDir write into. If not set, CREATE_NEW, READ and WRITE. The CamelAzureStorageDataLakeOpenOptions header replaces this option for the producer. | Set | ||
The path of the directory whose paths the consumer and listPaths list, relative to the root of the file system. The listing fails if the path does not exist. For uploadFromFile, it is instead the path of the local file to upload. The CamelAzureStorageDataLakePath header replaces this option for the producer. | String | ||
The POSIX access permissions of the file that createFile and upload create, for the owner, the owning group and others, in symbolic (rwxr-x---) or 4-digit octal (0750) notation. Only for an account with a hierarchical namespace. The CamelAzureStorageDataLakePermission header replaces this option. | String | ||
The length in bytes of the file once flushToFile has committed the appended data, including the data committed before. If not set, the current committed length of the file, which commits no newly appended data. The CamelAzureStorageDataLakePosition header replaces this option. | Long | ||
Whether the consumer and listPaths also list the paths in the subdirectories of path, at all levels. If false, they list only the direct children of path. For deleteDirectory, whether to delete the directory with all its content: if false, the directory must be empty. The CamelAzureStorageDataLakeRecursive header replaces this option for the producer. | false | Boolean | |
A Java regular expression that the whole path of a listed file or directory must match, for example .*\.csv, for the consumer to read it or for listPaths to return it. The paths are filtered after they are listed. The CamelAzureStorageDataLakeRegex header replaces this option for the producer. | String | ||
Whether flushToFile keeps the appended data beyond position that it does not commit. If false, the service deletes that uncommitted data. The CamelAzureStorageDataLakeRetainCommitedData header replaces this option. | false | Boolean | |
Autowired To use a custom com.azure.storage.file.datalake.DataLakeServiceClient for the requests to the Data Lake Storage service. When this option is set or autowired, the client brings the address and the authentication, and credentialType and the other credential options are not used. | DataLakeServiceClient | ||
Autowired To use a com.azure.storage.common.StorageSharedKeyCredential, which holds the account name and an account key of the storage account, when credentialType is SHARED_KEY_CREDENTIAL. When it is set and credentialType is not, credentialType becomes SHARED_KEY_CREDENTIAL. Its account name gives the address of the service, and accountKey is not used. Not used when serviceClient is set. | StorageSharedKeyCredential | ||
The ID of the Microsoft Entra ID tenant: of the application of clientId and clientSecret when credentialType is CLIENT_SECRET, and the tenant that the default Azure credential authenticates in when credentialType is AZURE_IDENTITY. For CLIENT_SECRET, not used when clientSecretCredential is set. Not used when serviceClient is set. | String | ||
The time, for example PT30S or 30s, within which each call to the service must complete, or it fails with an exception. If not set, only the timeouts of the HTTP client apply. For listPaths, listFileSystem and the listing of the consumer, it applies to each page of the listing. It does not apply to reading a file as a stream (getFile without an OutputStream body, and the consumer without fileDir), to openQueryInputStream and to the delete of deleteAfterRead. The CamelAzureStorageDataLakeTimeout header replaces this option for the producer. | Duration | ||
The umask, in 4-digit octal notation such as 0027, that restricts the permissions of the file that createFile and upload create. Only for an account with a hierarchical namespace. The CamelAzureStorageDataLakeUmask header replaces this option. | String | ||
Whether listPaths returns the owner and group of each path as user principal names instead of Microsoft Entra ID object IDs. Only for an account with a hierarchical namespace. The CamelAzureStorageDataLakeUserPrincipalNameReturned header replaces this option. | false | Boolean | |
Delete a file from the file system once its exchange has completed. When the exchange fails, the file is not deleted, so it is consumed again at the next poll. | false | boolean | |
If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead. | false | boolean | |
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 | |
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 | ||
Sets the exchange pattern when the consumer creates an exchange. Enum values:
| ExchangePattern | ||
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 | ||
The operation that the producer performs. The CamelAzureStorageDataLakeOperation header replaces this option. Enum values:
| listFileSystem | DataLakeOperationsDefinition | |
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 | |
The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in. | int | ||
The number of subsequent idle polls that should happen before the backoffMultipler should kick-in. | int | ||
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 | ||
Milliseconds before the next poll. | 500 | long | |
If greedy is enabled, then the ScheduledPollConsumer will run immediately again, if the previous run polled 1 or more messages. | false | boolean | |
How long a poll may run before the health check of the consumer reports DOWN. The health check is otherwise based on the polls that are done, so it stays UP while a poll hangs, for example on a read without timeout from a connection that went silent. A poll includes routing the messages it polled, so set this above the longest poll you expect. The poll is not interrupted. The value is in millis (not affected by timeUnit). The default 0 turns this off. | 0 | long | |
Milliseconds before the first poll starts. | 1000 | long | |
Specifies a maximum limit of number of fires. So if you set it to 1, the scheduler will only fire once. If you set it to 5, it will only fire five times. A value of zero or negative means fire forever. | 0 | long | |
The consumer logs a start/complete log line when it polls. This option allows you to configure the logging level for that. Enum values:
| TRACE | LoggingLevel | |
Allows for configuring a custom/shared thread pool to use for the consumer. By default each consumer has its own single threaded thread pool. | ScheduledExecutorService | ||
To use a cron scheduler from either camel-spring or camel-quartz component. Use value spring or quartz for built in scheduler. | none | Object | |
To configure additional properties when using a custom scheduler or any of the Quartz, Spring based scheduler. This is a multi-value option with prefix: scheduler. | Map | ||
Whether the scheduler should be auto started. | true | boolean | |
Time unit for initialDelay and delay options. Enum values:
| MILLISECONDS | TimeUnit | |
Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details. | true | boolean | |
The account key of the storage account, which authenticates the client together with accountName when credentialType is SHARED_KEY_CREDENTIAL. Setting it does not change credentialType, which must be set. Not used when sharedKeyCredential or serviceClient is set. | String | ||
The client secret of the Microsoft Entra ID application, which authenticates the client together with clientId and tenantId when credentialType is CLIENT_SECRET. Not used when clientSecretCredential or serviceClient is set. | String | ||
Autowired To use a com.azure.identity.ClientSecretCredential, which authenticates with a client secret of a Microsoft Entra ID application, when credentialType is CLIENT_SECRET. When it is set, the clientId, clientSecret and tenantId options are not used. Not used when serviceClient is set. | ClientSecretCredential | ||
Autowired To use a com.azure.core.credential.AzureSasCredential, which holds a shared access signature (SAS) token, when credentialType is AZURE_SAS. When it is set and credentialType is not, credentialType becomes AZURE_SAS, unless sharedKeyCredential is set. When it is set, sasSignature is not used. Not used when serviceClient is set. | AzureSasCredential | ||
The shared access signature (SAS) token that authenticates the client when credentialType is AZURE_SAS. Setting it does not change credentialType, which must be set. Not used when sasCredential or serviceClient is set. | String |
Message Headers
The Azure Storage Data Lake Service component supports the following message header(s), which is/are listed below:
| Name | Description | Default | Type |
|---|---|---|---|
CamelAzureStorageDataLakeListFileSystemsOptions (producer) Constant: | The options of listFileSystem, as a com.azure.storage.file.datalake.models.ListFileSystemsOptions, such as a prefix of the file system names, the number of file systems per page and the details to return. | ListFileSystemsOptions | |
CamelAzureStorageDataLakeTimeout (producer) Constant: | The time within which each call to the service must complete, or it fails with an exception. It replaces the timeout option. | Duration | |
CamelAzureStorageDataLakeOperation (producer) Constant: | The operation that the producer performs. It replaces the operation option. Enum values:
| DataLakeOperationsDefinition | |
CamelAzureStorageDataLakeFileSystemName (producer) Constant: | The name of the file system that the producer operates on, all lowercase. It replaces the fileSystemName option. | String | |
CamelAzureStorageDataLakeDirectoryName (producer) Constant: | The path of the directory for createFile and deleteDirectory. It replaces the directoryName option. | String | |
CamelAzureStorageDataLakeFileName (common) Constant: | (producer) The path of the file in the file system for the operations on a file, or for createFile the name of the file to create in the directory. It replaces the fileName option. downloadToFile sets it to the path of the local file that it wrote. (consumer) The path of the consumed file in the file system. | String | |
CamelAzureStorageDataLakeMetadata (common) Constant: | (producer) The metadata, as name-value pairs, that createFileSystem, createFile, upload and uploadFromFile give to the file system or file. (consumer) The metadata of the file, set by the consumer with fileDir, getFile with an OutputStream body and downloadToFile. | Map | |
CamelAzureStorageDataLakePublicAccessType (producer) Constant: | The public access level, CONTAINER or BLOB, of the file system that createFileSystem creates. If not set, the data of the file system is private. | PublicAccessType | |
CamelAzureStorageDataLakeRawHttpHeaders (consumer) Constant: | The HTTP headers of the response of the service, as they were received. Set by the producer operations, except listFileSystem, listPaths, uploadFromFile and getFile without an OutputStream body, and by the consumer with fileDir. | HttpHeaders | |
CamelAzureStorageDataLakeRequestCondition (producer) Constant: | The conditions, such as an ETag, a modification time or a lease ID, that the file, directory or file system must meet for the request to succeed, as a com.azure.storage.file.datalake.models.DataLakeRequestConditions. For getFile, downloadToFile, deleteFile, flushToFile, upload, uploadFromFile, createFile, deleteDirectory and deleteFileSystem. appendToFile only uses its lease ID. | DataLakeRequestConditions | |
CamelAzureStorageDataLakeListPathOptions (producer) Constant: | The options of listPaths, as a com.azure.storage.file.datalake.models.ListPathsOptions. When it is set, the path, recursive, maxResults and userPrincipalNameReturned options and headers are not used. | ListPathsOptions | |
CamelAzureStorageDataLakePath (producer) Constant: | For listPaths, the path of the directory to list; for uploadFromFile, the path of the local file to upload. It replaces the path option. | String | |
CamelAzureStorageDataLakeRecursive (producer) Constant: | Whether listPaths also lists the paths in the subdirectories, and whether deleteDirectory deletes a directory that is not empty, with all its content. It replaces the recursive option. | Boolean | |
CamelAzureStorageDataLakeMaxResults (producer) Constant: | The number of paths per page, at most 5000, that the service returns for listPaths, which still returns the paths of all pages. It replaces the maxResults option. | Integer | |
CamelAzureStorageDataLakeUserPrincipalNameReturned (producer) Constant: | Whether listPaths returns the owner and group of each path as user principal names instead of Microsoft Entra ID object IDs. It replaces the userPrincipalNameReturned option. | Boolean | |
CamelAzureStorageDataLakeRegex (producer) Constant: | A Java regular expression that the whole path of a listed file or directory must match for listPaths to return it. It replaces the regex option. | String | |
CamelAzureStorageDataLakeFileDir (producer) Constant: | The local directory that downloadToFile downloads the file into. It replaces the fileDir option. | String | |
CamelAzureStorageDataLakeAccessTier (consumer) Constant: | Access tier of file. | AccessTier | |
CamelAzureStorageDataLakeContentMD5 (producer) Constant: | The MD5 hash of the content. For appendToFile, the service checks the appended content against it and the request fails if they differ. For getFile with an OutputStream body and downloadToFile, any value makes the service return the MD5 hash of the range read, which must then be at most 4 MiB. The consumer with fileDir, getFile with an OutputStream body and downloadToFile set it to the MD5 hash of the file. | byte[] | |
CamelAzureStorageDataLakeFileRange (producer) Constant: | The range of bytes to read, as a com.azure.storage.file.datalake.models.FileRange, for getFile and downloadToFile. It replaces the fileOffset and dataCount options. If none of them is set, the whole file is read. | FileRange | |
CamelAzureStorageDataLakeParallelTransferOptions (producer) Constant: | The options, such as the block size and the maximum concurrency, with which downloadToFile, upload and uploadFromFile transfer the data in parallel, as a com.azure.storage.common.ParallelTransferOptions. | ParallelTransferOptions | |
CamelAzureStorageDataLakeOpenOptions (producer) Constant: | The java.nio.file.OpenOption set that opens or creates the local file that downloadToFile writes into. It replaces the openOptions option. | Set | |
CamelAzureStorageDataLakeAccessTierChangeTime (consumer) Constant: | Datetime when the access tier of the blob last changed. | OffsetDateTime | |
CamelAzureStorageDataLakeArchiveStatus (consumer) Constant: | Archive status of file. | ArchiveStatus | |
CamelAzureStorageDataLakeConsumedFileSystemName (consumer) Constant: | The name of the file system the file was consumed from. It is not the CamelAzureStorageDataLakeFileSystemName header, which overrides the file system of a producer. | String | |
CamelAzureStorageDataLakeCacheControl (consumer) Constant: | Cache control specified for the file. | String | |
CamelAzureStorageDataLakeContentDisposition (consumer) Constant: | Content disposition specified for the file. | String | |
CamelAzureStorageDataLakeContentEncoding (consumer) Constant: | Content encoding specified for the file. | String | |
CamelAzureStorageDataLakeContentLanguage (consumer) Constant: | Content language specified for the file. | String | |
CamelAzureStorageDataLakeContentType (consumer) Constant: | Content type specified for the file. | String | |
CamelAzureStorageDataLakeCopyCompletionTime (consumer) Constant: | Conclusion time of the last attempted Copy Blob operation where this file was the destination file. | OffsetDateTime | |
CamelAzureStorageDataLakeCopyId (consumer) Constant: | String identifier for this copy operation. | String | |
CamelAzureStorageDataLakeCopyProgress (consumer) Constant: | Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operation where this file was the destination file. | String | |
CamelAzureStorageDataLakeCopySource (consumer) Constant: | URL up to 2 KB in length that specifies the source file or file used in the last attempted Copy Blob operation where this file was the destination file. | String | |
CamelAzureStorageDataLakeCopyStatus (consumer) Constant: | Status of the last copy operation performed on the file. Enum values:
| CopyStatusType | |
CamelAzureStorageDataLakeCopyStatusDescription (consumer) Constant: | The description of the copy’s status. | String | |
CamelAzureStorageDataLakeCreationTime (consumer) Constant: | Creation time of the file. | OffsetDateTime | |
CamelAzureStorageDataLakeEncryptionKeySha256 (consumer) Constant: | The SHA-256 hash of the encryption key used to encrypt the file. | String | |
CamelAzureStorageDataLakeETag (consumer) Constant: | The ETag of the file. | String | |
CamelAzureStorageDataLakeFileSize (consumer) Constant: | The size of the file in bytes. | Long | |
CamelAzureStorageDataLakeLastModified (consumer) Constant: | Datetime when the file was last modified. | OffsetDateTime | |
CamelMessageTimestamp (consumer) Constant: | The time the file was last modified, in milliseconds since the epoch, with second precision (the last three digits are always 0). Set together with CamelAzureStorageDataLakeLastModified. | long | |
CamelAzureStorageDataLakeLeaseDuration (consumer) Constant: | Type of lease on the file. Enum values:
| LeaseDurationType | |
CamelAzureStorageDataLakeLeaseState (consumer) Constant: | State of the lease on the file. Enum values:
| LeaseStateType | |
CamelAzureStorageDataLakeLeaseStatus (consumer) Constant: | Status of the lease on the file. Enum values:
| LeaseStatusType | |
CamelAzureStorageDataLakeIncrementalCopy (producer) Constant: | Flag indicating if the file was incrementally copied. | Boolean | |
CamelAzureStorageDataLakeServerEncrypted (consumer) Constant: | Flag indicating if the file’s content is encrypted on the server. | Boolean | |
CamelAzureStorageDataLakeDownloadLinkExpiration (producer) Constant: | How long, in milliseconds, the link that downloadLink generates stays valid. It replaces the downloadLinkExpiration option. | Long | |
CamelAzureStorageDataLakeDownloadLink (consumer) Constant: | The link that downloadLink generates: the URL of the file with a service SAS that grants read access to it. | String | |
CamelAzureStorageDataLakeFileOffset (producer) Constant: | The position in bytes at which appendToFile appends the data. It replaces the fileOffset option for appendToFile only: it does not change the range that getFile and downloadToFile read. | Long | |
CamelAzureStorageDataLakeLeaseId (producer) Constant: | Not used: the producer does not read this header. Give the lease ID in the CamelAzureStorageDataLakeRequestCondition header instead. | String | |
CamelAzureStorageDataLakePathHttpHeaders (producer) Constant: | The HTTP properties of the file, such as its content type, content encoding and cache control, as a com.azure.storage.file.datalake.models.PathHttpHeaders, which createFile, upload, uploadFromFile and flushToFile set on the file. | PathHttpHeaders | |
CamelAzureStorageDataLakeRetainCommitedData (producer) Constant: | Whether flushToFile keeps the appended data beyond the position that it does not commit. It replaces the retainUncommitedData option. | Boolean | |
CamelAzureStorageDataLakeClose (producer) Constant: | Whether the file changed event that flushToFile raises tells that the file is complete (true) or that it was modified (false). It replaces the close option. | Boolean | |
CamelAzureStorageDataLakePosition (producer) Constant: | The length in bytes of the file once flushToFile has committed the appended data, including the data committed before. It replaces the position option. | Long | |
CamelAzureStorageDataLakeExpression (producer) Constant: | The query expression of openQueryInputStream. It replaces the expression option. | String | |
CamelAzureStorageDataLakeInputSerialization (producer) Constant: | The format of the file that openQueryInputStream queries, such as a FileQueryDelimitedSerialization (CSV) or a FileQueryJsonSerialization. Not used when the CamelAzureStorageDataLakeQueryOptions header is set. | FileQuerySerialization | |
CamelAzureStorageDataLakeOutputSerialization (producer) Constant: | The format of the result of openQueryInputStream, such as a FileQueryDelimitedSerialization (CSV) or a FileQueryJsonSerialization. Not used when the CamelAzureStorageDataLakeQueryOptions header is set. | FileQuerySerialization | |
CamelAzureStorageDataLakeErrorConsumer (producer) Constant: | A java.util.function.Consumer that receives the errors that the service reports while it runs the query of openQueryInputStream. Not used when the CamelAzureStorageDataLakeQueryOptions header is set. | Consumer | |
CamelAzureStorageDataLakeProgressConsumer (producer) Constant: | A java.util.function.Consumer that receives the progress of the query of openQueryInputStream, as the number of bytes scanned. Not used when the CamelAzureStorageDataLakeQueryOptions header is set. | Consumer | |
CamelAzureStorageDataLakeQueryOptions (producer) Constant: | All the options of openQueryInputStream, as a com.azure.storage.file.datalake.options.FileQueryOptions. When it is set, the expression option and the other query headers are not used. | FileQueryOptions | |
CamelAzureStorageDataLakePermission (producer) Constant: | The POSIX access permissions of the file that createFile and upload create, in symbolic (rwxr-x---) or 4-digit octal (0750) notation. It replaces the permission option. | String | |
CamelAzureStorageDataLakeUmask (producer) Constant: | The umask, in 4-digit octal notation, that restricts the permissions of the file that createFile and upload create. It replaces the umask option. | String | |
CamelAzureStorageDataLakeFileClient (producer) Constant: | The com.azure.storage.file.datalake.DataLakeFileClient that the operations on a file use instead of the client of fileName, which must still be set. createFile sets it to the client of the file that it created. | DataLakeFileClient | |
CamelAzureStorageDataLakeFlush (producer) Constant: | Whether appendToFile also flushes the file, which commits the appended data. If not set, false: the data must then be committed with flushToFile. | Boolean |
Message Body
The message body at each side of the Azure Storage Data Lake Service component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.
| Side | Body | Description |
|---|---|---|
Consumer |
| The content of the file, one message per file: a stream that reads it, or with fileDir the java.io.File it is downloaded to. The name of the file is in the CamelAzureStorageDataLakeFileName header; without fileName, every file of the file system is consumed, the directories skipped. |
Producer input |
| The content to write for upload and appendToFile: text, bytes, a stream or a file; a Map or no body fails: marshal it first. getFile writes into an OutputStream body. The other operations do not use the body: uploadFromFile reads the file of the path option.
|
Producer output |
| A List of the items of the SDK for listFileSystem, the default, and listPaths. A stream of the content for getFile, or the OutputStream body it wrote into, and of the query result for openQueryInputStream; the java.io.File for downloadToFile; the link for downloadLink; the PathInfo for flushToFile and the DataLakeFileClient for createFile; true for createFileSystem and the operations that upload, append or delete, with their results in headers.
|
The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.
Methods of authentication
To use this component, you will have to provide at least one of the specific credentialType parameters:
-
SHARED_KEY_CREDENTIAL: ProvideaccountNameandaccountKeyfor your azure account or provide StorageSharedKeyCredential instance which can be provided intosharedKeyCredentialoption. -
CLIENT_SECRET: Provide ClientSecretCredential instance which can be provided intoclientSecretCredentialoption or provideaccountName,clientId,clientSecretandtenantIdfor authentication with Azure Active Directory. -
SERVICE_CLIENT_INSTANCE: Provide a DataLakeServiceClient instance which can be provided intoserviceClientoption. -
AZURE_IDENTITY: Use the Default Azure Credential Provider Chain -
AZURE_SAS: ProvidesasSignatureorsasCredentialparameters to use SAS mechanism
The default is CLIENT_SECRET.
Usage
For example, to download content from file test.txt located on the filesystem in camelTesting storage account, use the following snippet:
-
Java
-
XML
-
YAML
from("azure-storage-datalake:camelTesting/filesystem?fileName=test.txt&accountKey=key")
.to("file://fileDirectory"); <route>
<from uri="azure-storage-datalake:camelTesting/filesystem?fileName=test.txt&accountKey=key"/>
<to uri="file://fileDirectory"/>
</route> - route:
from:
uri: azure-storage-datalake:camelTesting/filesystem
parameters:
fileName: test.txt
accountKey: key
steps:
- to:
uri: file://fileDirectory Automatic detection of a service client
The component is capable of automatically detecting the presence of a DataLakeServiceClient bean in the registry. Hence, if your registry has only one instance of type DataLakeServiceClient, it will be automatically used as the default client. You won’t have to explicitly define it as an uri parameter.
Azure Storage DataLake Producer Operations
The various operations supported by Azure Storage DataLake are as given below:
Operations on Service level
For these operations, accountName option is required
| Operation | Description |
|---|---|
| List all the file systems that are present in the given azure account. |
Operations on File system level
For these operations, accountName and fileSystemName options are required
| Operation | Description |
|---|---|
| Create a new file System with the storage account |
| Delete the specified file system within the storage account |
| Returns list of all the files within the given path in the given file system, with folder structure flattened |
Operations on Directory level
For these operations, accountName, fileSystemName and directoryName options are required
| Operation | Description |
|---|---|
| Create a new file in the specified directory within the fileSystem |
| Delete the specified directory within the file system |
Operations on file level
For these operations, accountName, fileSystemName and fileName options are required
| Operation | Description |
|---|---|
| Get the contents of a file. The content is written to the body when the body is an |
| Download the entire file from the file system into a path specified by fileDir. |
| Generate a download link for the specified file using Shared Access Signature (SAS). The expiration time to be set for the link can be specified otherwise 1 hour is taken as default. |
| Delete the specified file. |
| Appends the data passed to the specified file in the file System. Flush command is required after append. |
| Flushes the data already appended to the specified file. |
| Opens an |
Refer to the examples section below for more details on how to use these operations
Examples
Consumer Examples
To consume a file from the storage datalake into a file using the file component, this can be done like this:
-
Java
-
XML
-
YAML
from("azure-storage-datalake:cameltesting/filesystem?fileName=test.txt&accountKey=yourAccountKey")
.to("file:/filelocation"); <route>
<from uri="azure-storage-datalake:cameltesting/filesystem?fileName=test.txt&accountKey=yourAccountKey"/>
<to uri="file:/filelocation"/>
</route> - route:
from:
uri: azure-storage-datalake:cameltesting/filesystem
parameters:
fileName: test.txt
accountKey: yourAccountKey
steps:
- to:
uri: file:/filelocation You can also directly write to a file without using the file component. For this, you will need to specify the path in fileDir option, to save it to your machine.
-
Java
-
XML
-
YAML
from("azure-storage-datalake:cameltesting/filesystem?fileName=test.txt&accountKey=yourAccountKey&fileDir=/test/directory")
.to("mock:results"); <route>
<from uri="azure-storage-datalake:cameltesting/filesystem?fileName=test.txt&accountKey=yourAccountKey&fileDir=/test/directory"/>
<to uri="mock:results"/>
</route> - route:
from:
uri: azure-storage-datalake:cameltesting/filesystem
parameters:
fileName: test.txt
accountKey: yourAccountKey
fileDir: /test/directory
steps:
- to:
uri: mock:results This component also supports batch consumer. So, you can consume multiple files from a file system by specifying the path from where you want to consume the files.
-
Java
-
XML
-
YAML
from("azure-storage-datalake:cameltesting/filesystem?accountKey=yourAccountKey&fileDir=/test/directory&path=abc/test")
.to("mock:results"); <route>
<from uri="azure-storage-datalake:cameltesting/filesystem?accountKey=yourAccountKey&fileDir=/test/directory&path=abc/test"/>
<to uri="mock:results"/>
</route> - route:
from:
uri: azure-storage-datalake:cameltesting/filesystem
parameters:
accountKey: yourAccountKey
fileDir: /test/directory
path: abc/test
steps:
- to:
uri: mock:results The consumer reads every file of the file system (or of path) at every poll. To consume each file once, set deleteAfterRead=true: the file is deleted once its exchange has completed. When the exchange fails, the file is kept and consumed again at the next poll. A file that is already gone is ignored, and a failure to delete goes to the exception handler of the consumer.
from("azure-storage-datalake:cameltesting/filesystem?accountKey=yourAccountKey&path=inbox&deleteAfterRead=true")
.to("mock:results"); Producer Examples
-
listFileSystem
ListFileSystemsOptions SDK typefrom("direct:start")
.process(exchange -> {
exchange.getIn().setHeader(DataLakeConstants.LIST_FILESYSTEMS_OPTIONS,
new ListFileSystemsOptions().setMaxResultsPerPage(10));
})
.to("azure-storage-datalake:cameltesting?operation=listFileSystem&serviceClient=#serviceClient")
.to("mock:results"); -
createFileSystem
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelAzureStorageDataLakeFileSystemName", constant("test1"))
.to("azure-storage-datalake:cameltesting?operation=createFileSystem&serviceClient=#serviceClient")
.to("mock:results"); <route>
<from uri="direct:start"/>
<setHeader name="CamelAzureStorageDataLakeFileSystemName">
<constant>test1</constant>
</setHeader>
<to uri="azure-storage-datalake:cameltesting?operation=createFileSystem&serviceClient=#serviceClient"/>
<to uri="mock:results"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelAzureStorageDataLakeFileSystemName
constant: test1
- to:
uri: azure-storage-datalake:cameltesting
parameters:
operation: createFileSystem
serviceClient: "#serviceClient"
- to:
uri: mock:results -
deleteFileSystem
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelAzureStorageDataLakeFileSystemName", constant("test1"))
.to("azure-storage-datalake:cameltesting?operation=deleteFileSystem&serviceClient=#serviceClient")
.to("mock:results"); <route>
<from uri="direct:start"/>
<setHeader name="CamelAzureStorageDataLakeFileSystemName">
<constant>test1</constant>
</setHeader>
<to uri="azure-storage-datalake:cameltesting?operation=deleteFileSystem&serviceClient=#serviceClient"/>
<to uri="mock:results"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelAzureStorageDataLakeFileSystemName
constant: test1
- to:
uri: azure-storage-datalake:cameltesting
parameters:
operation: deleteFileSystem
serviceClient: "#serviceClient"
- to:
uri: mock:results -
listPaths
ListPathsOptions SDK typefrom("direct:start")
.process(exchange -> {
exchange.getIn().setHeader(DataLakeConstants.LIST_PATH_OPTIONS,
new ListPathsOptions().setPath("/main"));
})
.to("azure-storage-datalake:cameltesting/filesystem?operation=listPaths&serviceClient=#serviceClient")
.to("mock:results"); -
getFile
The CamelAzureStorageDataLakeFileRange header selects the byte range to read. Otherwise, set both fileOffset and dataCount on the endpoint to select a range. This applies whether the operation returns an InputStream or writes to an OutputStream supplied as the message body. The CamelAzureStorageDataLakeRequestCondition header applies request conditions, such as an ETag or lease, to both download paths, including streaming reads without a range. Consumers without fileDir also use the streaming path and honor the endpoint fileOffset and dataCount options. Remove these options to consume the entire file.
This can be done in two ways. We can either set an OutputStream in the exchange body:
OutputStream for the file content to be written tofrom("direct:start")
.process(exchange -> {
exchange.getIn().setBody(outputStream);
})
.to("azure-storage-datalake:cameltesting/filesystem?operation=getFile&fileName=test.txt&serviceClient=#serviceClient")
.to("mock:results"); Only a body that is an OutputStream is written to. Any other body, or no body, is replaced by an InputStream of the file content, which can be processed further downstream. So a File, Path or the file of a file consumer in the body is not written to: to save a file locally, use the downloadToFile operation, or a file endpoint after getFile.
from("direct:start")
.to("azure-storage-datalake:cameltesting/filesystem?operation=getFile&fileName=test.txt&serviceClient=#serviceClient")
.process(exchange -> {
InputStream inputStream = exchange.getMessage().getBody(InputStream.class);
System.out.println(IOUtils.toString(inputStream, StandardCharsets.UTF_8.name()));
})
.to("mock:results"); -
deleteFile
-
Java
-
XML
-
YAML
from("direct:start")
.to("azure-storage-datalake:cameltesting/filesystem?operation=deleteFile&fileName=test.txt&serviceClient=#serviceClient")
.to("mock:results"); <route>
<from uri="direct:start"/>
<to uri="azure-storage-datalake:cameltesting/filesystem?operation=deleteFile&fileName=test.txt&serviceClient=#serviceClient"/>
<to uri="mock:results"/>
</route> - route:
from:
uri: direct:start
steps:
- to:
uri: azure-storage-datalake:cameltesting/filesystem
parameters:
operation: deleteFile
fileName: test.txt
serviceClient: "#serviceClient"
- to:
uri: mock:results -
downloadToFile
-
Java
-
XML
-
YAML
from("direct:start")
.to("azure-storage-datalake:cameltesting/filesystem?operation=downloadToFile&fileName=test.txt&fileDir=/test/mydir&serviceClient=#serviceClient")
.to("mock:results"); <route>
<from uri="direct:start"/>
<to uri="azure-storage-datalake:cameltesting/filesystem?operation=downloadToFile&fileName=test.txt&fileDir=/test/mydir&serviceClient=#serviceClient"/>
<to uri="mock:results"/>
</route> - route:
from:
uri: direct:start
steps:
- to:
uri: azure-storage-datalake:cameltesting/filesystem
parameters:
operation: downloadToFile
fileName: test.txt
fileDir: /test/mydir
serviceClient: "#serviceClient"
- to:
uri: mock:results -
downloadLink
from("direct:start")
.to("azure-storage-datalake:cameltesting/filesystem?operation=downloadLink&fileName=test.txt&serviceClient=#serviceClient")
.process(exchange -> {
String link = exchange.getMessage().getBody(String.class);
System.out.println(link);
})
.to("mock:results"); -
appendToFile
InputStream body for the data to appendfrom("direct:start")
.process(exchange -> {
final String data = "test data";
final InputStream inputStream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
exchange.getIn().setBody(inputStream);
})
.to("azure-storage-datalake:cameltesting/filesystem?operation=appendToFile&fileName=test.txt&serviceClient=#serviceClient")
.to("mock:results"); -
flushToFile
Set position or the CamelAzureStorageDataLakePosition header to the final file length in bytes, including any previously committed data. For example, after appending 20 bytes to a 100-byte file, set the position to 120. The header overrides the endpoint option. If neither is set, the operation uses the current committed file length; set the final position explicitly to commit newly appended data.
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelAzureStorageDataLakePosition", constant(120))
.to("azure-storage-datalake:cameltesting/filesystem?operation=flushToFile&fileName=test.txt&serviceClient=#serviceClient")
.to("mock:results"); <route>
<from uri="direct:start"/>
<setHeader name="CamelAzureStorageDataLakePosition">
<constant>120</constant>
</setHeader>
<to uri="azure-storage-datalake:cameltesting/filesystem?operation=flushToFile&fileName=test.txt&serviceClient=#serviceClient"/>
<to uri="mock:results"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelAzureStorageDataLakePosition
constant: "120"
- to:
uri: azure-storage-datalake:cameltesting/filesystem
parameters:
operation: flushToFile
fileName: test.txt
serviceClient: "#serviceClient"
- to:
uri: mock:results -
openQueryInputStream
For this operation, you should have already registered for query acceleration on the azure portal.
FileQueryOptions SDK typefrom("direct:start")
.process(exchange -> {
exchange.getIn().setHeader(DataLakeConstants.QUERY_OPTIONS,
new FileQueryOptions("SELECT * from BlobStorage"));
})
.to("azure-storage-datalake:cameltesting/filesystem?operation=openQueryInputStream&fileName=test.txt&serviceClient=#serviceClient")
.to("mock:results"); -
upload
InputStream body for the data to uploadfrom("direct:start")
.process(exchange -> {
final String data = "test data";
final InputStream inputStream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
exchange.getIn().setBody(inputStream);
})
.to("azure-storage-datalake:cameltesting/filesystem?operation=upload&fileName=test.txt&serviceClient=#serviceClient")
.to("mock:results"); -
uploadFromFile
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelAzureStorageDataLakePath", constant("test/file.txt"))
.to("azure-storage-datalake:cameltesting/filesystem?operation=uploadFromFile&fileName=test.txt&serviceClient=#serviceClient")
.to("mock:results"); <route>
<from uri="direct:start"/>
<setHeader name="CamelAzureStorageDataLakePath">
<constant>test/file.txt</constant>
</setHeader>
<to uri="azure-storage-datalake:cameltesting/filesystem?operation=uploadFromFile&fileName=test.txt&serviceClient=#serviceClient"/>
<to uri="mock:results"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelAzureStorageDataLakePath
constant: test/file.txt
- to:
uri: azure-storage-datalake:cameltesting/filesystem
parameters:
operation: uploadFromFile
fileName: test.txt
serviceClient: "#serviceClient"
- to:
uri: mock:results -
createFile
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelAzureStorageDataLakeDirectoryName", constant("test/file/"))
.to("azure-storage-datalake:cameltesting/filesystem?operation=createFile&fileName=test.txt&serviceClient=#serviceClient")
.to("mock:results"); <route>
<from uri="direct:start"/>
<setHeader name="CamelAzureStorageDataLakeDirectoryName">
<constant>test/file/</constant>
</setHeader>
<to uri="azure-storage-datalake:cameltesting/filesystem?operation=createFile&fileName=test.txt&serviceClient=#serviceClient"/>
<to uri="mock:results"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelAzureStorageDataLakeDirectoryName
constant: "test/file/"
- to:
uri: azure-storage-datalake:cameltesting/filesystem
parameters:
operation: createFile
fileName: test.txt
serviceClient: "#serviceClient"
- to:
uri: mock:results -
deleteDirectory
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelAzureStorageDataLakeDirectoryName", constant("test/file/"))
.to("azure-storage-datalake:cameltesting/filesystem?operation=deleteDirectory&serviceClient=#serviceClient")
.to("mock:results"); <route>
<from uri="direct:start"/>
<setHeader name="CamelAzureStorageDataLakeDirectoryName">
<constant>test/file/</constant>
</setHeader>
<to uri="azure-storage-datalake:cameltesting/filesystem?operation=deleteDirectory&serviceClient=#serviceClient"/>
<to uri="mock:results"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelAzureStorageDataLakeDirectoryName
constant: "test/file/"
- to:
uri: azure-storage-datalake:cameltesting/filesystem
parameters:
operation: deleteDirectory
serviceClient: "#serviceClient"
- to:
uri: mock:results Testing
Please run all the unit tests and integration tests while making changes to the component as changes or version upgrades can break things. For running all the tests in the component, you will need to obtain azure accountName and accessKey. After obtaining the same, you can run the full test on this component directory by running the following maven command
mvn verify -Dazure.storage.account.name=<accountName> -Dazure.storage.account.key=<accessKey> You can also skip the integration test and run only basic unit test by using the command
mvn test