Chapter 70. SFTP Source
Receive data from an SFTP server.
70.1. Configuration Options Copy linkLink copied to clipboard!
The following table summarizes the configuration options available for the sftp-source Kamelet:
| Property | Name | Description | Type | Default | Example |
|---|---|---|---|---|---|
| connectionHost * | Connection Host | The hostname of the SFTP server. | string | ||
| connectionPort * | Connection Port | The port of the FTP server. | string | 22 | |
| directoryName * | Directory Name | The starting directory. | string | ||
| autoCreate | Autocreate Missing Directories | Automatically create starting directory. | boolean | True | |
| binary | Binary | Specifies the file transfer mode, BINARY or ASCII. Default is ASCII (false). | boolean | False | |
| delete | Delete | If true, the file is deleted after it is processed successfully. | boolean | False | |
| idempotent | Idempotency | Skip already-processed files. | boolean | True | |
| ignoreFileNotFoundOrPermissionError | Ignore File Not Found Or Permission Error | Whether to ignore when (trying to list files in directories or when downloading a file), which does not exist or due to permission error. By default when a directory or file does not exists or insufficient permission, then an exception is thrown. Setting this option to true allows to ignore that instead. | boolean | False | |
| passiveMode | Passive Mode | Sets the passive mode connection. | boolean | False | |
| password | Password | The password to access the SFTP server. | string | ||
| privateKeyFile | Private Key File | Set the private key file so that the SFTP endpoint can do private key verification. | string | ||
| privateKeyPassphrase | Private Key Passphrase | Set the private key file passphrase so that the SFTP endpoint can do private key verification. | string | ||
| privateKeyUri | Private Key URI | Set the private key file (loaded from classpath by default) so that the SFTP endpoint can do private key verification. | string | ||
| recursive | Recursive | If a directory, look for files in all sub-directories as well. | boolean | False | |
| strictHostKeyChecking | Strict Host Checking | Sets whether to use strict host key checking. | string | False | |
| useUserKnownHostsFile | Use User Known Hosts File | If knownHostFile has not been explicit configured then use the host file from System.getProperty(user.home)/.ssh/known_hosts. | boolean | True | |
| username | Username | The username to access the SFTP server. | string |
* = Fields marked with an asterisk are mandatory.
70.2. Dependencies Copy linkLink copied to clipboard!
70.2.1. Quarkus dependencies Copy linkLink copied to clipboard!
<dependencies>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifact>camel-quarkus-core</artifact>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifact>camel-quarkus-ftp</artifact>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifact>camel-quarkus-kamelet</artifact>
</dependency>
<dependency>
<groupId>org.apache.camel.kamelets</groupId>
<artifact>camel-kamelets-utils</artifact>
<version>4.8.5</version>
</dependency>
</dependencies>
70.3. Usage Copy linkLink copied to clipboard!
70.3.1. Camel JBang usage Copy linkLink copied to clipboard!
70.3.1.1. Prerequisites for JBang Copy linkLink copied to clipboard!
- Install JBang.
You have executed the following command:
jbang app install camel@apache/camel
70.3.1.2. Running a route with JBang Copy linkLink copied to clipboard!
Suppose you have a file named route.yaml with this content:
- route:
from:
uri: "kamelet:timer-source"
parameters:
period: 10000
message: 'test'
steps:
- to:
uri: "kamelet:log-sink"
You can now run it directly through the following command.
camel run route.yaml
70.3.2. Knative Source Copy linkLink copied to clipboard!
You can use the sftp-source Kamelet as a Knative source by binding it to a Knative object.
sftp-source-binding.yaml
apiVersion: camel.apache.org/v1
kind: Pipe
metadata:
name: sftp-source-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: sftp-source
properties:
connectionHost: "The Connection Host"
directoryName: "The Directory Name"
password: "The Password"
username: "The Username"
sink:
ref:
kind: Channel
apiVersion: messaging.knative.dev/v1
name: mychannel
70.3.3. Kafka Source Copy linkLink copied to clipboard!
You can use the sftp-source Kamelet as a Kafka source by binding it to a Kafka topic.
sftp-source-binding.yaml
apiVersion: camel.apache.org/v1
kind: Pipe
metadata:
name: sftp-source-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: sftp-source
properties:
connectionHost: "The Connection Host"
directoryName: "The Directory Name"
password: "The Password"
username: "The Username"
sink:
ref:
kind: KafkaTopic
apiVersion: kafka.strimzi.io/v1beta1
name: my-topic