pfx-sftp Component
Summary: Reference for the pfx-sftp Camel component -- secure file transfer for uploading/downloading integration files.
Overview
The pfx-sftp component extends the standard Apache Camel SFTP component (SftpComponent) with Pricefx connection management. It allows routes to reference a named SFTP connection configured in Integration Manager, automatically resolving host, port, path, credentials, and host-key checking settings.
The component is registered under the scheme pfx-sftp and belongs to the FILE category.
When to Use
|
Scenario |
Description |
|---|---|
|
Upload export files |
Push files generated by Pricefx (price lists, quotes, etc.) to an external SFTP server for downstream consumption. |
|
Download import files |
Pull files from an SFTP server to feed into Pricefx data loads (products, customers, price data). |
|
Poll for new files |
Continuously monitor an SFTP directory for new files arriving from external systems, triggering import routes automatically. |
URI Format
pfx-sftp://[user@]host[:port]/directoryName[?options]
When a connection parameter is provided, the host, port, path, username, password, and strictHostKeyChecking values are resolved from the named SFTP connection. Any directory specified in the URI is appended to the connection's base path.
If no connection is specified, the URI behaves like the standard Camel sftp component and all parameters must be provided inline or via query options.
Quick Start
Download with a named connection
<route id="sftpDownload">
<from uri="pfx-sftp://dummy?connection=my-sftp-conn&noop=true&fileName=data.csv"/>
<to uri="direct:processFile"/>
</route>
The dummy host is overridden by the connection's host. The noop=true option leaves the file on the server after reading.
Upload with a named connection
<route id="sftpUpload">
<from uri="direct:uploadFile"/>
<to uri="pfx-sftp://dummy/outbound?connection=my-sftp-conn&tempPrefix=.uploading"/>
</route>
Files are uploaded to the outbound subdirectory relative to the connection's base path, using a temporary prefix during transfer.
Connection Setup
SFTP connections are configured in Integration Manager with the following fields:
|
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
(required) |
Address of the SFTP server |
|
|
|
|
Port the SFTP server listens on |
|
|
|
|
Starting access point (base directory) for the connection |
|
|
|
(optional) |
Username for authentication |
|
|
|
(optional) |
Password for authentication (encrypted at rest) |
|
|
|
|
Whether host keys are verified during connection. Disabled by default. |
Connections also support certificate-based authentication. When a certificateName is set on the connection, the corresponding private key is injected into the SFTP configuration.
Common Pitfalls
|
Pitfall |
Recommendation |
|---|---|
|
Hardcoding credentials in route XML |
Always use a named |
|
Leaving |
The default is |
|
Path resolution confusion |
Remember that a URI directory is appended to the connection's base |
|
Missing |
Without a temporary prefix, downstream systems may pick up partially written files. Use |
Error Handling
-
If a named connection cannot be found, a
NonRecoverableExceptionis thrown at route startup with the message:Cannot find SftpConnection with name: [<name>]. -
Standard Camel SFTP error handling applies for file-level operations (read locks, permission errors, network failures).
See Also
-
pfx-sftp:parameters -- all connection and endpoint parameters in detail
-
pfx-sftp: no method -- usage without an explicit method (consumer/producer patterns)
-
Apache Camel SFTP Component -- upstream documentation