GH-8713: Add support for custom SftpClient
Fixes https://github.com/spring-projects/spring-integration/issues/8713 * Introduce `DefaultSftpSessionFactory.createSftpClient()` factory method which can be overridden for any custom `SftpClient` use-case * Add changes to the docs * Some code clean up **Cherry-pick to `6.1.x`**
This commit is contained in:
@@ -38,13 +38,26 @@ When using this feature, you must wrap the session factory in a caching session
|
||||
|
||||
If the cache is reset, the session is disconnected only when the last channel is closed.
|
||||
|
||||
The connection is refreshed if it is found to be disconnected when a new operation obtains a session.
|
||||
The connection is refreshed if it to be disconnected when a new operation obtains a session.
|
||||
=====
|
||||
|
||||
Now all you need to do is inject this SFTP session factory into your adapters.
|
||||
|
||||
NOTE: A more practical way to provide values for the SFTP session factory is to use Spring's https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#beans-factory-placeholderconfigurer[property placeholder support].
|
||||
|
||||
Starting with version 6.1.3, the `DefaultSftpSessionFactory` introduces a `createSftpClient(...)` to support a custom `SftpClient`.
|
||||
See a sample below of how to override `createSftpChannelSubsystem()` method in your custom `SftpClient` to add, for example, some custom `RequestHandler` for SFTP sub-system requests and replies:
|
||||
|
||||
[source, java]
|
||||
----
|
||||
@Override
|
||||
protected ChannelSubsystem createSftpChannelSubsystem(ClientSession clientSession) {
|
||||
ChannelSubsystem sftpChannelSubsystem = super.createSftpChannelSubsystem(clientSession);
|
||||
sftpChannelSubsystem.addRequestHandler((channel, request, wantReply, buffer) -> ...);
|
||||
return sftpChannelSubsystem;
|
||||
}
|
||||
----
|
||||
|
||||
[[sftp-session-factory-properties]]
|
||||
== Configuration Properties
|
||||
|
||||
|
||||
@@ -72,3 +72,9 @@ See xref:mongodb.adoc#mongodb-message-store[MongoDB Message Store] for an exampl
|
||||
|
||||
`FtpLastModifiedFileListFilter`, `SftpLastModifiedFileListFilter` and `SmbLastModifiedFileListFilter` have been introduced to allow files filtering based on a last-modified strategy respectively for `FTP`, `SFTP` and `SMB`.
|
||||
See xref:ftp/inbound.adoc#ftp-inbound[FTP Inbound Channel Adapter], xref:sftp/inbound.adoc#sftp-inbound[SFTP Inbound Channel Adapter], and xref:smb.adoc#smb-inbound[SMB Inbound Channel Adapter] for more information.
|
||||
|
||||
[[x6.2-sftp-changes]]
|
||||
=== SFTP Support Changes
|
||||
|
||||
A new `DefaultSftpSessionFactory.createSftpClient(...)` method has been introduced to support a custom `SftpClient` when overridden.
|
||||
See xref:sftp/session-factory.adoc#sftp-session-factory[SFTP Session Factory] for more information.
|
||||
|
||||
Reference in New Issue
Block a user