pfx-sftp Component

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

XML
<route id="sftpDownload">
    <from uri="pfx-sftp://dummy?connection=my-sftp-conn&amp;noop=true&amp;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

XML
<route id="sftpUpload">
    <from uri="direct:uploadFile"/>
    <to uri="pfx-sftp://dummy/outbound?connection=my-sftp-conn&amp;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

host

String

(required)

Address of the SFTP server

port

int

22

Port the SFTP server listens on

path

String

/

Starting access point (base directory) for the connection

username

String

(optional)

Username for authentication

password

String

(optional)

Password for authentication (encrypted at rest)

strictHostKeyChecking

boolean

false

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 connection and store credentials in the Integration Manager connection configuration. This keeps secrets encrypted at rest and out of version control.

Leaving strictHostKeyChecking disabled in production

The default is false for convenience during development. In production, enable it and ensure the server's host key is trusted to prevent man-in-the-middle attacks.

Path resolution confusion

Remember that a URI directory is appended to the connection's base path. If the connection path is /data and the URI directory is exports, the effective path is /data/exports, not /exports.

Missing tempPrefix on uploads

Without a temporary prefix, downstream systems may pick up partially written files. Use tempPrefix=.uploading or similar.

Error Handling

  • If a named connection cannot be found, a NonRecoverableException is 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