This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Integration 6.4.0!spring-doc.cn

Apache Mina FTP Server Events

The ApacheMinaFtplet, added in version 5.2, listens for certain Apache Mina FTP server events and publishes them as ApplicationEvent s which can be received by any ApplicationListener bean, @EventListener bean method, or Event Inbound Channel Adapter.spring-doc.cn

Currently, supported events are:spring-doc.cn

Each of these is a subclass of ApacheMinaFtpEvent; you can configure a single listener to receive all the event types. The source property of each event is a FtpSession, from which you can obtain information such as the client address; a convenient getSession() method is provided on the abstract event.spring-doc.cn

Events other than session open/close have another property FtpRequest which has properties such as the command and arguments.spring-doc.cn

To configure the server with the listener (which must be a Spring bean), add it to the server factory:spring-doc.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();

To consume these events using a Spring Integration event adapter:spring-doc.cn

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