FTPS
Since Camel 2.2
Both producer and consumer are supported
This component provides access to remote file systems over the FTP secure and SFTP protocols.
Maven users will need to add the following dependency to their pom.xml for this component:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-ftp</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency> 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 FTPS component supports the following options which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
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 | |
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 | |
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 | |
Whether an ftps endpoint without sslContextParameters uses the global SSL context parameters of the CamelContext. | false | boolean |
Endpoint Options
The FTPS endpoint is configured using URI syntax:
ftps:host:port/directoryName
With the following path and query parameters:
Query Parameters
| Name | Description | Default | Type |
|---|---|---|---|
Whether to transfer files in binary mode (true) or in ASCII mode (false). Only ftp and ftps use it: sftp and mina-sftp transfer the bytes of the file as they are. | false | boolean | |
The charset (encoding) of the file content, such as UTF-8. The consumer uses it when the file content is read as text, and the producer writes text with this charset. When writing, Camel may have to read the whole message into memory to convert it to the charset, so do not use it with big messages. | String | ||
Whether to disconnect from the remote server right after use: the consumer disconnects after each poll, and the producer after each message it writes. This only closes the current connection: to stop a consumer, stop the consumer or the route instead. | false | boolean | |
The name of the done file, an empty file that marks a file as complete. Producer: after the file is written, the done file is written in the same directory. Consumer: a file is only consumed when its done file exists in the same directory, and the done file is deleted once the file is consumed (unless noop=true). The name is either a fixed name, or uses the placeholders $\{file:name} and $\{file:name.noext}, which are the only ones supported; the consumer supports the fixed part of the name either as a prefix or as a suffix, not both. | String | ||
The file name, as an expression such as the File Language. Consumer: only the file with exactly this name is consumed, as the name is not a pattern (use antInclude or include to consume the files that match a pattern); for example consume the file of today with mydata-$\{date:now:yyyyMMdd}.txt. Producer: the name of the file to write; when set, it is used instead of the CamelFileName header, unless that header holds an org.apache.camel.Expression (a String header is used as it is, not evaluated). A String value of this option is evaluated with the File Language, and an Expression object as it is. The producer also supports the CamelOverruleFileName header, which takes precedence over the CamelFileName header and is used only once, so CamelFileName does not have to be stored and restored around the producer. | String | ||
Used for jailing (restricting) writing files to the starting directory (and sub) only. This is enabled by default to not allow Camel to write files to outside directories (to be more secured out of the box). You can turn this off to allow writing files to directories outside the starting directory, such as parent or root folders. For consumers that use a localWorkDirectory, this also restricts the downloaded files to stay within the configured localWorkDirectory. | true | boolean | |
Whether to use passive mode for the data connections, in which the client connects to the server, instead of active mode (the default), in which the server connects to the client. Only ftp and ftps use it. | false | boolean | |
The path separator to use in the paths that Camel sends to the server: UNIX replaces each backslash with a slash, Windows replaces each slash with a backslash, and Auto leaves the separators of the path as they are. Enum values:
| UNIX | PathSeparator | |
The interval in seconds between two log messages about the progress of an upload or download that is in progress, so that a long transfer shows its progress. | 5 | int | |
The logging level for the progress of uploads and downloads: their start and end, and the progress of a transfer every transferLoggingIntervalSeconds. Enum values:
| DEBUG | LoggingLevel | |
Whether to also log each chunk of data that is uploaded or downloaded, and the steps of the connection (connect, login, scanning for files, disconnect), at the transferLoggingLevel. | false | boolean | |
Whether ftp and ftps check that a file exists by listing only that file (true), instead of listing its directory and looking for the file name (false). Some FTP servers do not support listing a file directly. The changed read lock (readLock=changed) also uses this option to get the file information. Enabling it speeds up the check when the directory holds many files. The sftp and mina-sftp components check whether a file exists, also for readLock=changed, with a single request whatever the number of files, so this option makes no difference for them. | false | boolean | |
Whether to send a noop command to check that the connection is still valid, as a pre-write check before uploading files (producer) and before each poll (consumer), and for ftp and ftps also before renaming or deleting a file on the server, such as when the consumer moves or deletes a processed file. This is enabled by default, which allows to silently re-connect if the connection was lost. However if this causes problems, you can turn this option off, and then a lost connection may only be found when the next operation fails. For example a rename or delete after a long-running route then fails if the server closed the idle connection meanwhile, so the file stays and is polled again, unless an idempotent repository prevents that. | true | boolean | |
If true, the file is deleted after it is processed successfully. Cannot be combined with move. | false | boolean | |
Sets the move failure expression based on Simple language. For example, to move files into a .error subdirectory use: .error. Note: When moving the files to the fail location Camel will handle the error and will not pick up the file again. | String | ||
If true, the consumer leaves the file in place: it does not move or delete the file after it is processed (preMove and moveFailed still apply, and delete=true takes precedence over noop). Good for read-only data or ETL. noop=true also turns on idempotent (unless idempotent is set), so the same files are not consumed over and over again. | false | boolean | |
Expression (such as File Language) used to dynamically set the filename when moving it before processing. For example to move in-progress files into the order directory set this value to order. | String | ||
When pre-sort is enabled then the consumer will sort the file and directory names during polling, that was retrieved from the file system. You may want to do this in case you need to operate on the files in a sorted order. The pre-sort is executed before the consumer starts to filter, and accept files to process by Camel. This option is default=false meaning disabled. The following values are supported: name (sort by file name), modified (sort by last-modified timestamp), size (sort by file size). To sort in descending (reverse) order, prefix the value with a minus sign (e.g., -modified to sort newest first). The value true is an alias for name (backward compatible). Enum values:
| String | ||
Whether to also consume the files in all the subdirectories of the starting directory (see minDepth and maxDepth). | false | boolean | |
Whether to resume a download that stopped before the end. The consumer keeps the part already downloaded in the local work directory, and asks the server to restart the transfer from there (the REST command), which the server must support. Requires localWorkDirectory and binary=true. | 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 | |
How the consumer downloads a file when no localWorkDirectory is set. When true, the message body is the stream of the remote file, which the route reads as the file is downloaded. When false, the whole file is loaded into memory before it is sent to the route. For ftp and ftps, stepwise must then be set to false, as both cannot be enabled at the same time. | 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 | |
Whether the consumer downloads the file. When false, the message body is null, but the consumer still creates an exchange with the details of the file, such as its name and size, in the headers. | true | 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 | ||
Whether the FTP server lists the entries of a directory with their absolute paths instead of their names. Some FTP servers do so: enable this option for them, and the consumer uses the last segment of each path as the name of the file or directory. | false | boolean | |
Whether the consumer ignores a directory or file that does not exist, or that it has no permission for, when it lists a directory or downloads a file. By default, an exception is thrown. | false | boolean | |
A custom org.apache.camel.spi.IdempotentRepository that keeps track of the files being consumed, so that a later poll does not pick up a file that is still in progress. By default, a memory based repository (of up to 50000 entries) is used. | IdempotentRepository | ||
A local directory to download the remote files into, so their content is stored in local files instead of in memory. Useful to save memory when consuming very big files. Not used by the file component. | String | ||
A custom org.apache.camel.spi.ExceptionHandler that handles the exceptions thrown when the consumer completes a file, by a commit or a rollback (such as moving or deleting the file). By default, the exceptions are logged at WARN level and ignored. | ExceptionHandler | ||
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 | ||
A pluggable org.apache.camel.component.file.GenericFileProcessStrategy allowing you to implement your own readLock option or similar. Can also be used when special conditions must be met before a file can be consumed, such as a special ready file exists. If this option is set then the readLock option does not apply. | GenericFileProcessStrategy | ||
Whether the consumer throws an exception when it cannot connect or log in to the server, or cannot create the starting directory. By default, the consumer logs a WARN and skips the poll. When enabled, the exception goes to the rollback method of the poll strategy (the pollStrategy option), which can handle it. | false | boolean | |
Whether the consumer lists the directory on the server to find the files to download (the LIST command for ftp and ftps). Set it to false when the server does not allow listing: the consumer then only downloads the file named by the fileName option, which must be set, and the file has no meta-data such as size, timestamp and permissions, as only a listing gives them. | true | boolean | |
The algorithm of a checksum to calculate from the content of the written file. The checksum is set in the CamelFileChecksum header (and written to a checksum file, see checksumWriteFile). The name is passed to java.security.MessageDigest, which accepts names such as MD5, SHA-1, SHA-256 or SHA3-256. Enum values:
| String | ||
Whether to also write the checksum to a file, when checksumFileAlgorithm is set. The checksum file is written in the same directory as the file, with the algorithm as extension (for example hello.txt.MD5 with checksumFileAlgorithm=MD5). | true | boolean | |
What to do when a file with the same name already exists: - Override - replaces the existing file (the default). - Append - adds the content to the existing file. - Fail - fails with a GenericFileOperationFailedException. - Ignore - keeps the existing file and writes nothing, without failing. - Move - moves the existing file to the name given by the moveExisting option (which must be set) before writing the file. The eagerDeleteTargetFile option controls what happens when a file already exists at that name. - TryRename - only used with tempFileName or tempPrefix: renames the temporary file to the real name without checking whether a file exists, which can be faster on some file systems and FTP servers. Enum values:
| Override | GenericFileExist | |
Whether to strip the leading paths from the file name, so only the name of the file is left. The consumer then sets the CamelFileName header to the name only, and the producer strips the paths from the name it writes (from the fileName option or the CamelFileName header). For example, files consumed recursively from subdirectories are then all written in a single directory. | false | boolean | |
Expression (such as File Language) used to compute file name to use when fileExist=Move is configured. To move files into a backup subdirectory just enter backup. This option only supports the following File Language tokens: file:name, file:name.ext, file:name.noext, file:onlyname, file:onlyname.noext, file:ext, and file:parent. Notice the file:parent is not supported by the FTP component, as the FTP component can only move any existing files to a relative directory based on current dir as base. | String | ||
The same as tempPrefix option but offering a more fine grained control on the naming of the temporary filename as it uses the File Language. The location for tempFilename is relative to the final file location in the option 'fileName', not the target directory in the base uri. For example if option fileName includes a directory prefix: dir/finalFilename then tempFileName is relative to that subdirectory dir. | String | ||
This option is used to write the file using a temporary name and then, after the write is complete, rename it to the real name. Can be used to identify files being written and also avoid consumers (not using exclusive read locks) reading in progress files. Is often used by FTP when uploading big files. | String | ||
Whether a message with a null body can be written. If true, an empty file is written: an existing file is truncated with fileExist=Override, and left unchanged with fileExist=Append. If false, a null body fails with a GenericFileOperationFailedException. | false | boolean | |
The permissions to set on each uploaded file, such as 640. Camel sends the command SITE CHMOD with this value after the upload, and does not check the reply of the server. | String | ||
Whether the producer disconnects from the remote server after the last message of a batch, which is a message whose exchange property CamelBatchComplete is true, such as the last file of a poll of a file consumer. This only closes the current connection. | false | boolean | |
Whether to delete an existing target file before the temporary file is written, when fileExist=Override is used with tempFileName or tempPrefix. Set it to false to keep the existing target file while the temporary file is written, for example when writing big files: the target file is then deleted just before the temporary file is renamed to it. With fileExist=Move, it also controls what happens when a file already exists at the name given by moveExisting: true deletes that file before the move, false fails the move with an exception. | true | boolean | |
Whether to set the last modified timestamp of the written file to the value of the CamelFileLastModified header (a java.util.Date or a long), for example to keep the timestamp of the source file. Nothing is set when the header is missing. Only used by the file component. | 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 | |
A custom FileMoveExistingStrategy that moves the existing file when fileExist=Move is used. By default, the component uses its own implementation, which moves the file to the name computed by moveExisting. | FileMoveExistingStrategy | ||
The range of local ports that the client listens on for data connections in active mode, as minPort-maxPort with both ports included, for example 10000-19999. Each data connection uses a random port of the range. Not used in passive mode. | String | ||
Automatically create missing directories in the file’s pathname. For the file consumer, that means creating the starting directory. For the file producer, it means the directory the files should be written to. | true | boolean | |
Maximum number of messages to keep in memory available for browsing. Use 0 for unlimited. | 100 | int | |
Buffer size in bytes used for writing files (or in case of FTP for downloading and uploading files). | 131072 | int | |
The timeout in milliseconds for establishing the connection to the server. For sftp, mina-sftp and scp, it also applies to the SSH handshake and the login. 0 means no timeout. | 10000 | int | |
A custom FTPClient (Apache Commons Net) to use instead of the client that Camel creates; for ftps an FTPSClient. Every consumer and producer of the endpoint uses this same instance. | FTPClient | ||
A custom FTPClientConfig (Apache Commons Net) for the FTP client, which configures how the client parses directory listings, such as the system type, the date formats, the time zone and the language of the server. | FTPClientConfig | ||
Properties to set on the FTPClientConfig, by the names of its setters, such as ftpClientConfig.serverLanguageCode=fr or ftpClientConfig.serverTimeZoneId=Europe/Paris. Without ftpClientConfig, Camel creates an FTPClientConfig for the UNIX system type. This is a multi-value option with prefix: ftpClientConfig. | Map | ||
Properties to set on the FTPClient, by the names of its setters, such as ftpClient.controlEncoding=UTF-8. The timeouts ftpClient.soTimeout and ftpClient.dataTimeout, in milliseconds, take precedence over the options soTimeout and timeout. This is a multi-value option with prefix: ftpClient. | Map | ||
The maximum number of attempts to connect to the remote server each time a connection is needed, reconnectDelay apart. Default is 3. 0 or less means a single attempt. A login that the server rejects is not retried. | int | ||
The delay in milliseconds between two attempts to connect to the remote server. | 1000 | long | |
The SITE commands to send to the FTP server after login. Separate several commands with a new line character. If the server does not accept a command, the connection fails. | String | ||
The socket timeout (SO_TIMEOUT) in milliseconds, so that a connection whose server no longer answers does not hang. For ftp and ftps, it is the read timeout of the control connection: a command whose reply does not come within this time fails. For sftp, it is the timeout of the JSch session: when the server sends nothing for this time, JSch sends a keep-alive message, and closes the connection after serverAliveCountMax such messages; it is not used when serverAliveInterval is set. The mina-sftp and scp components do not use it. 0 means no timeout. | 300000 | int | |
Whether to change directory one level at a time when traversing directories to download files, and when uploading a file to a directory. When disabled, the file operations use the full path instead, for example when the server does not allow changing directory. For ftp and ftps, stepwise cannot be used together with streamDownload. | true | boolean | |
The data timeout in milliseconds. For ftp and ftps, it is the read timeout of the data connection (the data timeout of the Apache Commons Net FTPClient), and 0 means no timeout. For scp, it is the timeout of the JSch session. The sftp and mina-sftp components do not use it. | 30000 | int | |
Excludes the files whose path, relative to the starting directory, matches one of these Ant style patterns, such as */.bak. Separate several patterns with a comma. Takes precedence over antInclude. | String | ||
Whether the antInclude and antExclude patterns are matched case sensitive. | true | boolean | |
Includes only the files whose path, relative to the starting directory, matches one of these Ant style patterns, such as */.txt. Separate several patterns with a comma. | String | ||
Allows for controlling whether the limit from maxMessagesPerPoll is eager or not. If eager then the limit is during the scanning of files, and the file, sftp, mina-sftp and smb consumers stop reading the directory once the limit is hit, unless preSort or doneFileName is used, as they need the whole directory. Where as false would scan all files, and then perform sorting. Setting this option to false allows for sorting all files first, and then limit the poll. Mind that this requires a higher memory usage as all file details are in memory to perform the sorting. | true | boolean | |
Excludes the files whose name matches this regular expression (matched ignoring the case). Takes precedence over include. It is a regular expression, not a wildcard: use antExclude for wildcards, or excludeExt to exclude files by extension. When the expression has characters such as the plus sign, set it with RAW() in an endpoint URI. | String | ||
Excludes the files with one of these extensions (ignoring the case), separated by comma, for example excludeExt=bak,dat. A file matches when its name ends with a dot and the extension, so both excludeExt=gz and excludeExt=tar.gz match mydata.tar.gz. For more flexibility use the include and exclude options. | String | ||
Pluggable filter as a org.apache.camel.component.file.GenericFileFilter class. Will skip files if filter returns false in its accept() method. | GenericFileFilter | ||
A File Language predicate that filters the subdirectories to scan with recursive=true: only the directories for which it is true are scanned. For example, to scan only the directory of today: $\{file:onlyname} == $\{date:now:yyyyMMdd}. | String | ||
A File Language predicate that filters the files: only the files for which it is true are consumed. For example, to filter on the file extension: $\{file:ext} == 'txt'. | String | ||
Option to use the Idempotent Consumer EIP pattern to let Camel skip already processed files. Will by default use a memory based LRUCache that holds 1000 entries. If noop=true then idempotent will be enabled as well to avoid consuming the same files over and over again. Setting only idempotentRepository or idempotentKey does not turn it on. | false | Boolean | |
Sets whether to eagerly add the filename to the idempotent repository or wait until the exchange is complete. Does not apply with an idempotent read lock (readLock=idempotent, idempotent-changed or idempotent-rename), which adds the filename when it acquires the lock. | true | Boolean | |
To use a custom idempotent key. By default the absolute path of the file is used. You can use the File Language, for example to use the file name and file size, you can do: idempotentKey=$\{file:name}-$\{file:size}. It is used only with idempotent=true (noop=true turns it on), or by an idempotent read lock (readLock=idempotent, idempotent-changed or idempotent-rename) of the file component. | String | ||
A pluggable repository org.apache.camel.spi.IdempotentRepository which by default use MemoryIdempotentRepository if none is specified and idempotent is true. It is used only with idempotent=true (noop=true turns it on), or by an idempotent read lock (readLock=idempotent, idempotent-changed or idempotent-rename) of the file component. Set without them, it does not skip any file. | IdempotentRepository | ||
Includes only the files whose name matches this regular expression (matched ignoring the case). It is a regular expression, not a wildcard: use antInclude for wildcards, or includeExt to include files by extension. When the expression has characters such as the plus sign, set it with RAW() in an endpoint URI. | String | ||
Includes only the files with one of these extensions (ignoring the case), separated by comma, for example includeExt=txt,xml. A file matches when its name ends with a dot and the extension, so both includeExt=gz and includeExt=tar.gz match mydata.tar.gz. For more flexibility use the include and exclude options. | String | ||
The maximum depth to traverse when recursively processing a directory. maxDepth=1 means only the starting directory. | 2147483647 | int | |
The maximum number of files to consume in one poll. 0 or negative (the default) means no limit. Can be used, for example, to avoid picking up thousands of files at once when the server starts. With eagerMaxMessagesPerPoll=true (the default) the limit applies while the files are scanned, before any sorting: with 100000 files and maxMessagesPerPoll=500, the first 500 files found are taken and then sorted. Set eagerMaxMessagesPerPoll=false to scan and sort all the files first, and then take the limit. | int | ||
The minimum depth to start processing when recursively processing a directory. Using minDepth=1 means the base directory. Using minDepth=2 means the first sub directory. | int | ||
Expression (such as Simple Language) used to dynamically set the filename when moving it after processing. To move files into a .done subdirectory just enter .done. | String | ||
A custom org.apache.camel.component.file.GenericFileExclusiveReadLockStrategy to use as the read lock. When set, the readLock option is not used. | GenericFileExclusiveReadLockStrategy | ||
The read lock strategy, so that the consumer only picks up a file that is not being written (in progress). The consumer waits for the read lock up to readLockTimeout. The strategies are: - none - no read lock is used. - changed - uses the length and the modification timestamp of the file to detect whether it is still being written, so files cannot be consumed as fast as with the others. The option readLockCheckInterval sets the time between two checks. - rename - tries to rename the file, to test whether the consumer can get an exclusive read lock. The other read locks of the file component (markerFile, fileLock and the idempotent read locks) are not supported, and fail when the consumer is created. Enum values:
| none | String | |
The interval in millis between the attempts to acquire the read lock, for the read locks that retry (changed, fileLock and rename, and also idempotent-changed and idempotent-rename of the file component). For example, set a higher interval with readLock=changed to cater for slow writes. The ftp, ftps, sftp, mina-sftp and azure-files components use 5000 by default. readLockTimeout must be higher than readLockCheckInterval; as a rule of thumb, make the timeout at least 2 or 3 times the interval, so the read lock has enough time to be acquired before the timeout. | 1000 | long | |
The logging level of the message logged when a read lock cannot be acquired, for example OFF for no logging. Used by the read locks changed, fileLock, idempotent, idempotent-changed, idempotent-rename and rename. Enum values:
| DEBUG | LoggingLevel | |
Whether the changed, fileLock and rename read locks also create a marker file, to keep other processes from picking up the same files. Set it to false, for example, to not write marker files to the file system. Only used by the file component. | true | boolean | |
The minimum age in millis a file must have before the changed read lock (readLock=changed or idempotent-changed) acquires it, for example readLockMinAge=300s for 5 minutes. When set, the read lock acquires a file as soon as it is older than this, without waiting for its length and timestamp to stay the same, which can make it faster. | 0 | long | |
The minimum length in bytes a file must have before the changed read lock (readLock=changed or idempotent-changed) acquires it. The default 1 means an empty file is not consumed; set 0 to consume empty files. | 1 | long | |
The timeout in millis to acquire the read lock. When the lock is not granted within the timeout, the file is skipped and tried again on the next poll. 0 or lower waits forever. Used by the changed, fileLock and rename read locks (and also idempotent-changed and idempotent-rename of the file component). The ftp, ftps, sftp, mina-sftp and azure-files components use 20000 by default. readLockTimeout must be higher than readLockCheckInterval; as a rule of thumb, make the timeout at least 2 or 3 times the interval, so the read lock has enough time to be acquired before the timeout. | 10000 | long | |
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 to log in with, sent with the FTP ACCT command when the server asks for an account after the password. Without a username, Camel logs in as anonymous with this account. | String | ||
Whether to turn off the defaults for the data channel protection. By default, Camel sends PBSZ 0 and PROT P after login when execPbsz and execProt are not set. With this option enabled, Camel sends PBSZ and PROT only for the options execPbsz and execProt that are set. | false | boolean | |
The protection buffer size that Camel sends with the PBSZ command after login, from 0 to 4294967295. When not set, Camel sends 0, unless disableSecureDataChannelDefaults is enabled. | Long | ||
The data channel protection level that Camel sends with the PROT command after login: C (Clear), S (Safe), E (Confidential) or P (Private). When not set, Camel sends P, unless disableSecureDataChannelDefaults is enabled. | String | ||
The key store with the client certificate: ftpClient.keyStore.file, ftpClient.keyStore.password, and optionally ftpClient.keyStore.keyPassword (the store password by default), ftpClient.keyStore.type (the default key store type of the JVM by default) and ftpClient.keyStore.algorithm (the default key manager algorithm of the JVM by default). Not used when sslContextParameters is set. This is a multi-value option with prefix: ftpClient.keyStore. | Map | ||
The trust store to check the certificate of the server with: ftpClient.trustStore.file, ftpClient.trustStore.password, and optionally ftpClient.trustStore.type (the default key store type of the JVM by default) and ftpClient.trustStore.algorithm (the default trust manager algorithm of the JVM by default). Without it, the default trust store of the JVM is used. Not used when sslContextParameters is set. This is a multi-value option with prefix: ftpClient.trustStore. | Map | ||
Whether to check that the certificate of the server matches the host Camel connects to, with the same rules as an HTTPS client. When disabled, any certificate accepted by the trust manager is accepted, whatever host it was issued for. This option does not apply to a custom ftpClient. | true | boolean | |
Whether to use implicit FTPS, where the connection starts with TLS, instead of explicit FTPS, where the client switches to TLS with the AUTH command. Implicit FTPS servers usually listen on port 990, and Camel connects to port 21 unless the endpoint sets the port. | false | boolean | |
Password to use for login. | String | ||
The protocol of the SSLContext that Camel creates for the FTPS client, such as TLSv1.3 or TLSv1.2. Not used when sslContextParameters is set. | TLSv1.3 | String | |
The SSL configuration (JSSE) for the FTPS client. When set, it replaces the options securityProtocol, ftpClient.keyStore. and ftpClient.trustStore. | SSLContextParameters | ||
The user name to log in with. For ftp and ftps, the login is anonymous when it is not set. | String | ||
To shuffle the list of files (sort in random order). | false | boolean | |
Sorts the files with File Language expressions, such as sortBy=file:name. Separate several groups with a semicolon to sort by the next group when the previous one is equal, such as sortBy=file:modified;file:name. Prefix a group with reverse: to sort it in reverse order, and with ignoreCase: to compare text ignoring the case (reverse: comes first when both are used). | String | ||
Pluggable sorter as a java.util.Comparator class that compares org.apache.camel.component.file.GenericFile objects. | Comparator |
Message Headers
The FTPS component supports the following message header(s), which is/are listed below:
| Name | Description | Default | Type |
|---|---|---|---|
| Constant: | A long value containing the file size. | long | |
CamelFileLastModified (consumer) Constant: | A Long value containing the last modified timestamp of the file. | long | |
| Constant: | Only the file name (the name with no leading paths). | String | |
| Constant: | (producer) Specifies the name of the file to write (relative to the endpoint directory). This name can be a String; a String with a file or simple Language expression; or an Expression object. If it’s null then Camel will auto-generate a filename based on the message unique ID. (consumer) Name of the consumed file as a relative file path with offset from the starting directory configured on the endpoint. | String | |
CamelFileNameConsumed (consumer) Constant: | The name of the file that has been consumed. | String | |
| Constant: | Whether the path of the consumed file is absolute (true), or relative (false). | Boolean | |
CamelFileAbsolutePath (consumer) Constant: | The absolute path to the file. For relative files this path holds the relative path instead. | String | |
| Constant: | The file path. For relative files this is the starting directory. For absolute files this is the absolute path. | String | |
CamelFileRelativePath (consumer) Constant: | The relative path. | String | |
| Constant: | The parent path. | String | |
CamelFileNameProduced (producer) Constant: | The path and name of the file that the producer wrote: the starting directory of the endpoint followed by the file name. This header is set by Camel, to provide the name of the file that was written. | String | |
CamelOverruleFileName (producer) Constant: | Is used for overruling CamelFileName header and use the value instead (but only once, as the producer will remove this header after writing the file). The value can only be a String. Notice that if the option fileName has been configured, then this is still being evaluated. | Object | |
CamelFileLocalWorkPath (consumer) Constant: | Path to the local work file, if local work directory is used. | String | |
CamelRemoteFileInputStream (consumer) Constant: | The input stream of the remote file, when the consumer uses streamDownload=true. | InputStream | |
| Constant: | The remote hostname. | String | |
| Constant: | The reply code of the last operation on the server. For ftp and ftps, it is the reply code of the FTP server. For sftp, it is the SFTP status code, 0 when the operation succeeded. The mina-sftp component does not set it. | int | |
| Constant: | The reply text of the last operation on the server. For ftp and ftps, it is the reply text of the FTP server. For sftp, it is OK when the operation succeeded, or the error message. The mina-sftp component does not set it. | String |
Message Body
The message body at each side of the FTPS 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 file as read: a RemoteFile, which converts to text, bytes or a stream; a stream with streamDownload; with preMove its content, a byte array.
Not known when |
Producer input |
| What converts to an InputStream: text, bytes, a stream or a file. A Map or a List fails: marshal it first.
|
Producer output |
|
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.
Usage
The FTPS component works as the FTP component, over TLS. It has the options of the FTP component, and security options for TLS, such as securityProtocol (TLSv1.3 by default), implicit and sslContextParameters.
The following route downloads the files of a directory on an FTPS server to a local folder. The consumer leaves the files on the server by default, so move moves each file to the done directory when it has been processed:
- route:
from:
uri: ftps://myserver:21/orders
parameters:
username: "{{ftps.username}}"
password: "{{ftps.password}}"
passiveMode: true
binary: true
move: done
steps:
- to:
uri: file:target/orders And this route uploads the files of a local folder:
- route:
from:
uri: file:outbox
steps:
- to:
uri: ftps://myserver:21/upload
parameters:
username: "{{ftps.username}}"
password: "{{ftps.password}}"
passiveMode: true
binary: true Read locks
The ftps consumer supports the read locks none, rename and changed. readLock=false and readLock=off mean none. Any other readLock value, such as the markerFile, fileLock, idempotent, idempotent-changed and idempotent-rename read locks of the File component, fails when the consumer is created, also with poll and pollEnrich, with IllegalArgumentException: ReadLock invalid. The readLock option is not checked when a custom exclusiveReadLockStrategy or processStrategy is set, as it does not apply then.
More Information
For more information, you can look at FTP component.