用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
属性,让您指定MessageSessionCallback
Bean 名称。
这session-callback 与command 和expression 属性。
使用 Java 进行配置时,不同的构造函数在FtpOutboundGateway 类。 |