该版本仍在开发中,尚未被视为稳定。对于最新的稳定版本,请使用 Spring Integration 7.0.0spring-doc.cadn.net.cn

Apache Mina FTP 服务器活动

阿帕奇MinaFtplet(阿帕奇MinaFtplet),在5.2版本中添加,监听某些Apache Mina FTP服务器事件并发布为ApplicationEvent可以被任意接收ApplicationListener@EventListenerBean方法,或事件入站通道适配器spring-doc.cadn.net.cn

目前支持的活动有:spring-doc.cadn.net.cn

这些都是 的一个子类阿帕奇MinaFtp事件;你可以配置一个监听器来接收所有类型的事件。 这每个事件的属性是FtpSession你可以从中获取诸如客户地址等信息;一个方便的getSession()方法在抽象事件上提供。spring-doc.cadn.net.cn

除会话开闭外,其他事件还有其他属性FtpRequest该系统具有命令和参数等属性。spring-doc.cadn.net.cn

要配置带有监听器的服务器(必须是 Spring Bean),请将其添加到服务器工厂:spring-doc.cadn.net.cn

FtpServerFactory serverFactory = new FtpServerFactory();
...
ListenerFactory factory = new ListenerFactory();
...
serverFactory.addListener("default", factory.createListener());
serverFactory.setFtplets(new HashMap<>(Collections.singletonMap("springFtplet", apacheMinaFtpletBean)));
server = serverFactory.createServer();
server.start();

使用Spring Integration事件适配器获取这些事件:spring-doc.cadn.net.cn

@Bean
public ApplicationEventListeningMessageProducer eventsAdapter() {
    ApplicationEventListeningMessageProducer producer =
        new ApplicationEventListeningMessageProducer();
    producer.setEventTypes(ApacheMinaFtpEvent.class);
    producer.setOutputChannel(eventChannel());
    return producer;
}