Camel Components

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, *.yaml files, 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

clientId (common)

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

close (common)

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

closeStreamAfterRead (common)

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

configuration (common)

The configuration that each endpoint of this component starts from, before the options of the endpoint are applied.

DataLakeConfiguration

credentialType (common)

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

  • SHARED_KEY_CREDENTIAL

  • AZURE_IDENTITY

  • AZURE_SAS

  • SERVICE_CLIENT_INSTANCE

CLIENT_SECRET

CredentialType

dataCount (common)

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

directoryName (common)

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

downloadLinkExpiration (common)

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

expression (common)

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

fileDir (common)

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

fileName (common)

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

fileOffset (common)

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

maxResults (common)

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

maxRetryRequests (common)

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

openOptions (common)

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

path (common)

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

permission (common)

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

position (common)

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

recursive (common)

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

regex (common)

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

retainUncommitedData (common)

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

serviceClient (common)

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

sharedKeyCredential (common)

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

tenantId (common)

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

timeout (common)

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

umask (common)

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

userPrincipalNameReturned (common)

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

bridgeErrorHandler (consumer)

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

deleteAfterRead (consumer)

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

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 starting the producer may take a little time and prolong the total processing time of the processing.

false

boolean

operation (producer)

The operation that the producer performs. The CamelAzureStorageDataLakeOperation header replaces this option.

Enum values:

  • listFileSystem

  • createFileSystem

  • deleteFileSystem

  • listPaths

  • getFile

  • downloadToFile

  • downloadLink

  • deleteFile

  • appendToFile

  • flushToFile

  • uploadFromFile

  • upload

  • openQueryInputStream

  • createFile

  • deleteDirectory

listFileSystem

DataLakeOperationsDefinition

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

healthCheckConsumerEnabled (health)

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

true

boolean

healthCheckProducerEnabled (health)

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

accountKey (security)

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

clientSecret (security)

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

clientSecretCredential (security)

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

sasCredential (security)

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

sasSignature (security)

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

accountName (common)

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

fileSystemName (common)

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

clientId (common)

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

close (common)

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

closeStreamAfterRead (common)

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

credentialType (common)

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

  • SHARED_KEY_CREDENTIAL

  • AZURE_IDENTITY

  • AZURE_SAS

  • SERVICE_CLIENT_INSTANCE

CLIENT_SECRET

CredentialType

dataCount (common)

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

dataLakeServiceClient (common)

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

directoryName (common)

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

downloadLinkExpiration (common)

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

expression (common)

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

fileDir (common)

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

fileName (common)

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

fileOffset (common)

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

maxResults (common)

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

maxRetryRequests (common)

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

openOptions (common)

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

path (common)

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

permission (common)

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

position (common)

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

recursive (common)

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

regex (common)

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

retainUncommitedData (common)

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

serviceClient (common)

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

sharedKeyCredential (common)

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

tenantId (common)

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

timeout (common)

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

umask (common)

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

userPrincipalNameReturned (common)

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

deleteAfterRead (consumer)

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

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

bridgeErrorHandler (consumer (advanced))

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

exceptionHandler (consumer (advanced))

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 (advanced))

Sets the exchange pattern when the consumer creates an exchange.

Enum values:

  • InOnly

  • InOut

ExchangePattern

pollStrategy (consumer (advanced))

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

operation (producer)

The operation that the producer performs. The CamelAzureStorageDataLakeOperation header replaces this option.

Enum values:

  • listFileSystem

  • createFileSystem

  • deleteFileSystem

  • listPaths

  • getFile

  • downloadToFile

  • downloadLink

  • deleteFile

  • appendToFile

  • flushToFile

  • uploadFromFile

  • upload

  • openQueryInputStream

  • createFile

  • deleteDirectory

listFileSystem

DataLakeOperationsDefinition

lazyStartProducer (producer (advanced))

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

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

delay (scheduler)

Milliseconds before the next poll.

500

long

greedy (scheduler)

If greedy is enabled, then the ScheduledPollConsumer will run immediately again, if the previous run polled 1 or more messages.

false

boolean

healthCheckMaxPollDuration (scheduler)

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

initialDelay (scheduler)

Milliseconds before the first poll starts.

1000

long

repeatCount (scheduler)

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

runLoggingLevel (scheduler)

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

  • DEBUG

  • INFO

  • WARN

  • ERROR

  • OFF

TRACE

LoggingLevel

scheduledExecutorService (scheduler)

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

scheduler (scheduler)

To use a cron scheduler from either camel-spring or camel-quartz component. Use value spring or quartz for built in scheduler.

none

Object

schedulerProperties (scheduler)

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

startScheduler (scheduler)

Whether the scheduler should be auto started.

true

boolean

timeUnit (scheduler)

Time unit for initialDelay and delay options.

Enum values:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

MILLISECONDS

TimeUnit

useFixedDelay (scheduler)

Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details.

true

boolean

accountKey (security)

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

clientSecret (security)

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

clientSecretCredential (security)

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

sasCredential (security)

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

sasSignature (security)

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: LIST_FILESYSTEMS_OPTIONS

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: TIMEOUT

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: DATALAKE_OPERATION

The operation that the producer performs. It replaces the operation option.

Enum values:

  • listFileSystem

  • createFileSystem

  • deleteFileSystem

  • listPaths

  • getFile

  • downloadToFile

  • downloadLink

  • deleteFile

  • appendToFile

  • flushToFile

  • uploadFromFile

  • upload

  • openQueryInputStream

  • createFile

  • deleteDirectory

DataLakeOperationsDefinition

CamelAzureStorageDataLakeFileSystemName (producer)

Constant: FILESYSTEM_NAME

The name of the file system that the producer operates on, all lowercase. It replaces the fileSystemName option.

String

CamelAzureStorageDataLakeDirectoryName (producer)

Constant: DIRECTORY_NAME

The path of the directory for createFile and deleteDirectory. It replaces the directoryName option.

String

CamelAzureStorageDataLakeFileName (common)

Constant: FILE_NAME

(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: METADATA

(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: PUBLIC_ACCESS_TYPE

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: RAW_HTTP_HEADERS

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: DATALAKE_REQUEST_CONDITION

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: LIST_PATH_OPTIONS

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: PATH

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: RECURSIVE

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: MAX_RESULTS

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: USER_PRINCIPAL_NAME_RETURNED

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: REGEX

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: FILE_DIR

The local directory that downloadToFile downloads the file into. It replaces the fileDir option.

String

CamelAzureStorageDataLakeAccessTier (consumer)

Constant: ACCESS_TIER

Access tier of file.

AccessTier

CamelAzureStorageDataLakeContentMD5 (producer)

Constant: CONTENT_MD5

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: FILE_RANGE

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: PARALLEL_TRANSFER_OPTIONS

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: OPEN_OPTIONS

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: ACCESS_TIER_CHANGE_TIME

Datetime when the access tier of the blob last changed.

OffsetDateTime

CamelAzureStorageDataLakeArchiveStatus (consumer)

Constant: ARCHIVE_STATUS

Archive status of file.

ArchiveStatus

CamelAzureStorageDataLakeConsumedFileSystemName (consumer)

Constant: CONSUMED_FILE_SYSTEM_NAME

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

Cache control specified for the file.

String

CamelAzureStorageDataLakeContentDisposition (consumer)

Constant: CONTENT_DISPOSITION

Content disposition specified for the file.

String

CamelAzureStorageDataLakeContentEncoding (consumer)

Constant: CONTENT_ENCODING

Content encoding specified for the file.

String

CamelAzureStorageDataLakeContentLanguage (consumer)

Constant: CONTENT_LANGUAGE

Content language specified for the file.

String

CamelAzureStorageDataLakeContentType (consumer)

Constant: CONTENT_TYPE

Content type specified for the file.

String

CamelAzureStorageDataLakeCopyCompletionTime (consumer)

Constant: COPY_COMPLETION_TIME

Conclusion time of the last attempted Copy Blob operation where this file was the destination file.

OffsetDateTime

CamelAzureStorageDataLakeCopyId (consumer)

Constant: COPY_ID

String identifier for this copy operation.

String

CamelAzureStorageDataLakeCopyProgress (consumer)

Constant: COPY_PROGRESS

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: COPY_SOURCE

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: COPY_STATUS

Status of the last copy operation performed on the file.

Enum values:

  • pending

  • success

  • aborted

  • failed

CopyStatusType

CamelAzureStorageDataLakeCopyStatusDescription (consumer)

Constant: COPY_STATUS_DESCRIPTION

The description of the copy’s status.

String

CamelAzureStorageDataLakeCreationTime (consumer)

Constant: CREATION_TIME

Creation time of the file.

OffsetDateTime

CamelAzureStorageDataLakeEncryptionKeySha256 (consumer)

Constant: ENCRYPTION_KEY_SHA_256

The SHA-256 hash of the encryption key used to encrypt the file.

String

CamelAzureStorageDataLakeETag (consumer)

Constant: E_TAG

The ETag of the file.

String

CamelAzureStorageDataLakeFileSize (consumer)

Constant: FILE_SIZE

The size of the file in bytes.

Long

CamelAzureStorageDataLakeLastModified (consumer)

Constant: LAST_MODIFIED

Datetime when the file was last modified.

OffsetDateTime

CamelMessageTimestamp (consumer)

Constant: MESSAGE_TIMESTAMP

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: LEASE_DURATION

Type of lease on the file.

Enum values:

  • infinite

  • fixed

LeaseDurationType

CamelAzureStorageDataLakeLeaseState (consumer)

Constant: LEASE_STATE

State of the lease on the file.

Enum values:

  • available

  • leased

  • expired

  • breaking

  • broken

LeaseStateType

CamelAzureStorageDataLakeLeaseStatus (consumer)

Constant: LEASE_STATUS

Status of the lease on the file.

Enum values:

  • locked

  • unlocked

LeaseStatusType

CamelAzureStorageDataLakeIncrementalCopy (producer)

Constant: INCREMENTAL_COPY

Flag indicating if the file was incrementally copied.

Boolean

CamelAzureStorageDataLakeServerEncrypted (consumer)

Constant: SERVER_ENCRYPTED

Flag indicating if the file’s content is encrypted on the server.

Boolean

CamelAzureStorageDataLakeDownloadLinkExpiration (producer)

Constant: DOWNLOAD_LINK_EXPIRATION

How long, in milliseconds, the link that downloadLink generates stays valid. It replaces the downloadLinkExpiration option.

Long

CamelAzureStorageDataLakeDownloadLink (consumer)

Constant: DOWNLOAD_LINK

The link that downloadLink generates: the URL of the file with a service SAS that grants read access to it.

String

CamelAzureStorageDataLakeFileOffset (producer)

Constant: FILE_OFFSET

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: LEASE_ID

Not used: the producer does not read this header. Give the lease ID in the CamelAzureStorageDataLakeRequestCondition header instead.

String

CamelAzureStorageDataLakePathHttpHeaders (producer)

Constant: PATH_HTTP_HEADERS

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: RETAIN_UNCOMMITED_DATA

Whether flushToFile keeps the appended data beyond the position that it does not commit. It replaces the retainUncommitedData option.

Boolean

CamelAzureStorageDataLakeClose (producer)

Constant: CLOSE

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: POSITION

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: EXPRESSION

The query expression of openQueryInputStream. It replaces the expression option.

String

CamelAzureStorageDataLakeInputSerialization (producer)

Constant: INPUT_SERIALIZATION

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: OUTPUT_SERIALIZATION

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: ERROR_CONSUMER

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: PROGRESS_CONSUMER

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: QUERY_OPTIONS

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: PERMISSION

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: UMASK

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: FILE_CLIENT

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: FLUSH

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

stream or file

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

any

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.

  • With operation=upload: text, bytes, stream or file

  • With operation=appendToFile: text, bytes, stream or file

Producer output

list (java.util.List<com.azure.storage.file.datalake.models.FileSystemItem>)

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.

  • With operation=createFileSystem: value (java.lang.Boolean)

  • With operation=deleteFileSystem: value (java.lang.Boolean)

  • With operation=deleteFile: value (java.lang.Boolean)

  • With operation=appendToFile: value (java.lang.Boolean)

  • With operation=uploadFromFile: value (java.lang.Boolean)

  • With operation=upload: value (java.lang.Boolean)

  • With operation=deleteDirectory: value (java.lang.Boolean)

  • With operation=listPaths: list (java.util.List<com.azure.storage.file.datalake.models.PathItem>)

  • With operation=getFile: stream

  • With operation=openQueryInputStream: stream

  • With operation=downloadToFile: file (java.io.File)

  • With operation=downloadLink: text (java.lang.String)

  • With operation=flushToFile: pojo (com.azure.storage.file.datalake.models.PathInfo)

  • With operation=createFile: pojo (com.azure.storage.file.datalake.DataLakeFileClient)

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: Provide accountName and accountKey for your azure account or provide StorageSharedKeyCredential instance which can be provided into sharedKeyCredential option.

  • CLIENT_SECRET: Provide ClientSecretCredential instance which can be provided into clientSecretCredential option or provide accountName, clientId, clientSecret and tenantId for authentication with Azure Active Directory.

  • SERVICE_CLIENT_INSTANCE: Provide a DataLakeServiceClient instance which can be provided into serviceClient option.

  • AZURE_IDENTITY: Use the Default Azure Credential Provider Chain

  • AZURE_SAS: Provide sasSignature or sasCredential parameters 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&amp;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

listFileSystem

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

createFileSystem

Create a new file System with the storage account

deleteFileSystem

Delete the specified file system within the storage account

listPaths

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

createFile

Create a new file in the specified directory within the fileSystem

deleteDirectory

Delete the specified directory within the file system

Operations on file level

For these operations, accountName, fileSystemName and fileName options are required

Operation Description

getFile

Get the contents of a file. The content is written to the body when the body is an OutputStream; any other body is replaced by an InputStream of the content.

downloadToFile

Download the entire file from the file system into a path specified by fileDir.

downloadLink

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.

deleteFile

Delete the specified file.

appendToFile

Appends the data passed to the specified file in the file System. Flush command is required after append.

flushToFile

Flushes the data already appended to the specified file.

openQueryInputStream

Opens an InputStream based on the query passed to the endpoint. For this operation, you must first register the query acceleration feature with your subscription.

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&amp;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&amp;accountKey=yourAccountKey&amp;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&amp;fileDir=/test/directory&amp;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

Java-only: uses ListFileSystemsOptions SDK type
from("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&amp;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&amp;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

Java-only: uses ListPathsOptions SDK type
from("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:

Java-only: sets an OutputStream for the file content to be written to
from("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.

Java-only: reads the file content as an `InputStream`
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&amp;fileName=test.txt&amp;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&amp;fileName=test.txt&amp;fileDir=/test/mydir&amp;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

Java-only: processes the generated download link from the response body
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

Java-only: creates an InputStream body for the data to append
from("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&amp;fileName=test.txt&amp;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.

Java-only: uses FileQueryOptions SDK type
from("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

Java-only: creates an InputStream body for the data to upload
from("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&amp;fileName=test.txt&amp;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&amp;fileName=test.txt&amp;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&amp;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