|
此版本仍在开发中,尚未被视为稳定版本。对于最新的稳定版本,请使用 Spring Integration 6.4.0! |
用MessageSessionCallback
从 Spring Integration 4.2 开始,您可以使用MessageSessionCallback<F, T>implementation 替换为<int-ftp:outbound-gateway/> (FtpOutboundGateway在 Java 中)对Session<FTPFile>使用requestMessage上下文。
它可用于任何非标准或低级 FTP作,并允许从集成流定义和功能接口 (Lambda) 实施注入进行访问,如下例所示:
@Bean
@ServiceActivator(inputChannel = "ftpChannel")
public MessageHandler ftpOutboundGateway(SessionFactory<FTPFile> sessionFactory) {
return new FtpOutboundGateway(sessionFactory,
(session, requestMessage) -> session.list(requestMessage.getPayload()));
}
另一个示例可能是对正在发送或检索的文件数据进行预处理或后处理。
使用 XML 配置时,<int-ftp:outbound-gateway/>提供session-callback属性,让您指定MessageSessionCallbackBean 名称。
这session-callback与command和expression属性。
使用 Java 进行配置时,不同的构造函数在FtpOutboundGateway类。 |