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.
Connection Fields
SFTP connections are configured in Integration Manager with the following fields (defined in SFTPConnection):
|
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.
Endpoint Parameters
The pfx-sftp endpoint inherits all parameters from the Camel SftpEndpoint. The following parameter is added by the Pricefx wrapper:
|
Parameter |
Type |
Description |
|---|---|---|
|
|
|
Name of the SFTP connection to use. When set, host, port, path, username, password, and strictHostKeyChecking are resolved from the connection. |
All standard Camel SFTP parameters remain available (e.g., fileName, delete, moveFailed, tempPrefix, recursive, noop, readLock, delay, etc.). See the Apache Camel SFTP documentation for the full list.
URI Resolution Logic
When connection is specified:
-
The connection is looked up from the Integration Manager connection registry.
-
Protocol is set to
sftp. -
Host, port, and strictHostKeyChecking are applied from the connection.
-
Directory resolution:
-
If no directory is specified in the URI, the connection's
pathis used. -
If a directory is specified and differs from the default, it is appended to the connection's
path(e.g., connection path/data+ URI directoryexports=/data/exports).
-
-
Username and password are applied if present on the connection.
-
A private key is injected if the connection has a
certificateName.
Usage Examples
Download with 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 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.
Inline credentials (no connection)
<route id="sftpInline">
<from uri="pfx-sftp://{{sftp.username}}@{{sftp.host}}:22/data/inbound?password={{sftp.password}}&strictHostKeyChecking=no"/>
<to uri="direct:processFile"/>
</route>
When no connection parameter is provided, credentials and host details must be specified in the URI directly. This approach is functionally equivalent to the standard Camel sftp component.
Poll with delay and move
<route id="sftpPoll">
<from uri="pfx-sftp://dummy/inbound?connection=my-sftp-conn&delay=30000&move=.done"/>
<to uri="direct:processFile"/>
</route>
Polls the inbound directory every 30 seconds and moves processed files to .done.
Connection Testing
The SFTPConnection.test() method opens an SFTP channel to verify connectivity. It connects using the configured host, port, username, password, and strictHostKeyChecking setting, then validates the configured path exists on the server.
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).
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 |
See Also
-
Connections -- managing SFTP connections in Integration Manager
-
Routes -- route configuration
-
Apache Camel SFTP Component -- upstream documentation