Spring integration SFTP出站网关命令
我需要在Spring integration SFTP出站网关命令,spring-integration,spring-integration-sftp,Spring Integration,Spring Integration Sftp,我需要在SFTPOutboundGateway中使用更多的命令(cd、mkdir、rmdir),但是根据,只有少数命令可用,我需要包含的其他命令都没有。这背后有什么原因吗?是否有(其他)方法使用更多命令,如cd、mkdir和rmdir cd在网关中没有任何意义,因为它实际上什么都不做 对于网关不支持的命令,请使用service activator中代码中的SftpRemoteFileGateway 对于模板不支持的命令,请使用 /** * Execute the callback's doIn
SFTPOutboundGateway
中使用更多的命令(cd、mkdir、rmdir),但是根据,只有少数命令可用,我需要包含的其他命令都没有。这背后有什么原因吗?是否有(其他)方法使用更多命令,如cd、mkdir和rmdir cd
在网关中没有任何意义,因为它实际上什么都不做
对于网关不支持的命令,请使用service activator中代码中的SftpRemoteFileGateway
对于模板不支持的命令,请使用
/**
* Execute the callback's doInSession method after obtaining a session.
* Reliably closes the session when the method exits.
*
* @param callback the SessionCallback.
* @param <T> The type returned by
* {@link SessionCallback#doInSession(org.springframework.integration.file.remote.session.Session)}.
* @return The result of the callback method.
*/
<T> T execute(SessionCallback<F, T> callback);
并直接在JSch客户端上进行操作。谢谢,我会尽我所能使用它们。但出于好奇,为什么rmdir、mkdir(例如)无法通过
SftpOutboundGateway
获得?只是以前没有人要求它们。通常,这样的命令会被用作某个较大序列的一部分,而Spring集成流可能不是实现这一点的最佳方式。
/**
* Called within the context of a session.
* Perform some operation(s) on the session. The caller will take
* care of closing the session after this method exits.
*
* @param session The session.
* @return The result of type T.
* @throws IOException Any IOException.
*/
T doInSession(Session<F> session) throws IOException;
/**
* Get the underlying client library's client instance for this session.
* Returns an {@code Object} to avoid significant changes to -file, -ftp, -sftp
* modules, which would be required
* if we added another generic parameter. Implementations should narrow the
* return type.
* @return The client instance.
* @since 4.1
*/
Object getClientInstance();
@Override
public ChannelSftp getClientInstance() {
return this.channel;
}