DinaMike
DinaMike

Reputation: 111

Spring Integration Sending Files to Remote Directory

I am trying to send files from my local directory to a remote directory by FTP, and could able to send the files successfully, but additionally the files are being FTP'ed to the local directory, since the ftpInbound is also establishing a FTP connection, which i don't want my application to do. If I remove inbound FTP channel adapter, couldn't feed the local directory path to the ftpOutbound also. Are there any other ways to resolve this problem ?

<int-ftp:inbound-channel-adapter id="ftpInbound"
                                channel="ftpChannel" 
                                session-factory="ftpClientFactory"
                                filename-pattern="*.txt"
                                local-directory="$dina-communication.batch-{localDirectory}"
                                temporary-file-suffix=".writing">
<int:poller fixed-rate="10000" />

</int-ftp:inbound-channel-adapter>

<int-ftp:outbound-channel-adapter  id="ftpOutbound"
                                channel="ftpChannel" 
                                session-factory="ftpClientFactory"
                                remote-directory="$dina-communication.batch-{Remote_directory}"
                                temporary-file-suffix=".writing">
</int-ftp:outbound-channel-adapter>

Upvotes: 2

Views: 1493

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121550

If you talk about feeding local directory content to the FTP server, you should consider to use really <int-file:inbound-channel-adapter>: http://docs.spring.io/spring-integration/reference/html/files.html#file-reading

There is also a sample on the matter: https://github.com/spring-projects/spring-integration-samples/tree/master/basic/file

You should replace your <int-ftp:inbound-channel-adapter> with just a <int-file:inbound-channel-adapter>.

Upvotes: 1

Related Questions