List of usage examples for org.springframework.integration.ftp.dsl Ftp inboundStreamingAdapter
public static FtpStreamingInboundChannelAdapterSpec inboundStreamingAdapter( RemoteFileTemplate<FTPFile> remoteFileTemplate)
From source file:org.springframework.integration.ftp.dsl.FtpTests.java
@Test public void testFtpInboundStreamFlow() throws Exception { QueueChannel out = new QueueChannel(); StandardIntegrationFlow flow = IntegrationFlows.from( Ftp.inboundStreamingAdapter(new FtpRemoteFileTemplate(sessionFactory())) .remoteDirectory("ftpSource").regexFilter(".*\\.txt$"), e -> e.id("ftpInboundAdapter").poller(Pollers.fixedDelay(100))).channel(out).get(); IntegrationFlowRegistration registration = this.flowContext.registration(flow).register(); Message<?> message = out.receive(10_000); assertNotNull(message);/*from w w w .j a v a 2s.c om*/ assertThat(message.getPayload(), instanceOf(InputStream.class)); assertThat(message.getHeaders().get(FileHeaders.REMOTE_FILE), isOneOf(" ftpSource1.txt", "ftpSource2.txt")); new IntegrationMessageHeaderAccessor(message).getCloseableResource().close(); message = out.receive(10_000); assertNotNull(message); assertThat(message.getPayload(), instanceOf(InputStream.class)); assertThat(message.getHeaders().get(FileHeaders.REMOTE_FILE), isOneOf(" ftpSource1.txt", "ftpSource2.txt")); new IntegrationMessageHeaderAccessor(message).getCloseableResource().close(); registration.destroy(); }