I am using Spring Intergation's SFTP with Outbound Channel Adapter for uploading files to a remote location. It works fine when it is sending files to one SFTP location. However, in my code, I am trying to send to multiple SFTP location based on different criteria.
The following is my set up - following from Spring Intergation doc
<beans:bean id="sftpSessionFactory"
class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
<beans:property name="host" value="localhost"/>
<beans:property name="password" value="password"/>
<beans:property name="port" value="22"/>
<beans:property name="user" value="user"/>
</beans:bean>
<int-sftp:outbound-channel-adapter id="sftpOutboundAdapter"
session-factory="sftpSessionFactory"
channel="outputChannel"
remote-directory="foo/bar"
use-temporary-filename="false"
mode="REPLACE"/>
My questions are:
- Does anyone know how to configure multiple SFTP Session
- For the outbound channel adapter, is there any way I can set this up in my code instead of XML, specially, I want to calculate the value for remote-directory.
Thanks