Using MessageSessionCallback
从 Spring Integration 4.2 开始,可以使用 MessageSessionCallback<F, T>
实现和 <int-ftp:outbound-gateway/>
(Java
中的 FtpOutboundGateway
) 对 Session<FTPFile>
使用 requestMessage
上下文执行任何操作。它可用于任何非标准或低级 FTP 操作,并允许从集成流定义和函数接口(Lambda)实现注入访问,如下例所示:
Starting with Spring Integration 4.2, you can use a MessageSessionCallback<F, T>
implementation with the <int-ftp:outbound-gateway/>
(FtpOutboundGateway
in Java) to perform any operations on the Session<FTPFile>
with the requestMessage
context.
It can be used for any non-standard or low-level FTP operations and allows access from an integration flow definition and functional interface (Lambda) implementation injection, as the following example shows:
@Bean
@ServiceActivator(inputChannel = "ftpChannel")
public MessageHandler ftpOutboundGateway(SessionFactory<FTPFile> sessionFactory) {
return new FtpOutboundGateway(sessionFactory,
(session, requestMessage) -> session.list(requestMessage.getPayload()));
}
另一个示例可能是预处理或后处理正在发送或检索的文件数据。
Another example might be to pre- or post-process the file data being sent or retrieved.
使用 XML 配置时,<int-ftp:outbound-gateway/>
提供 session-callback
属性,可用于指定 MessageSessionCallback
bean 名称。
When using XML configuration, the <int-ftp:outbound-gateway/>
provides a session-callback
attribute to let you specify the MessageSessionCallback
bean name.
|
The |