このバージョンはまだ開発中であり、まだ安定しているとは見なされていません。最新の安定バージョンについては、Spring Integration 6.5.3 を使用してください! |
MessageSessionCallback を使用する
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 to 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()));
}別の例は、送信または取得されるファイルデータの前処理または後処理です。
XML 構成を使用する場合、<int-ftp:outbound-gateway/> は session-callback 属性を提供して、MessageSessionCallback Bean 名を指定できるようにします。
session-callback は、command および expression 属性と相互に排他的です。Java を使用して構成する場合、FtpOutboundGateway (Javadoc) クラスでさまざまなコンストラクターを使用できます。 |