2

I have multiple location from where i have to download those files and then will delete those files or will archive those downloaded files on the remote server. Following is what i want to do but the problem is with little knowledge i don't know either this is possible or not.

ApplicationContext:

<bean id="defaultSftpSessionFactory"
            class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
        <property name="host" value="${sftp.host}"/>
        <property name="user" value="${sftp.username}"/>

        <property name="port" value="${sftp.serverPort}"/>
         <property name="privateKey" value="classpath:IBS_KEYS/id_rsa.txt"/>

         <property name="privateKeyPassphrase" value="${sftp.passphrase}"/>

    </bean>

    <bean id="sftpSessionFactory" class="org.springframework.integration.file.remote.session.CachingSessionFactory">
        <constructor-arg ref="defaultSftpSessionFactory" />

    </bean>

<int-sftp:inbound-channel-adapter id="sftpAdapterAutoCreate"
            session-factory="sftpSessionFactory"
            channel="requestSFTPNODEVChannel"
            filename-pattern="*.*"
            remote-directory="/home/oracle/"
            preserve-timestamp="true"
            local-directory="C:/temp/"
            auto-create-local-directory="true"
            temporary-file-suffix=".writing"
            delete-remote-files="true">
    <int:poller fixed-rate="1000"/>
</int-sftp:inbound-channel-adapter>


 <int-sftp:inbound-channel-adapter id="sftpAdapterAutoCreate"
            session-factory="sftpSessionFactory"
            channel="requestSFTPDKDEVChannel"
            filename-pattern="*.*"
            remote-directory="/home/oracle/Outgoing/"
            preserve-timestamp="true"
            local-directory="C:/temp1/"
            auto-create-local-directory="true"
            temporary-file-suffix=".writing"
            delete-remote-files="true">
    <int:poller fixed-rate="1000"/>
</int-sftp:inbound-channel-adapter>

    <int:channel id="requestSFTPNODEVChannel">
        <int:queue/>
    </int:channel>  

<int:channel id="requestSFTPDKDEVChannel">
        <int:queue/>
    </int:channel> 
user3548196
  • 355
  • 1
  • 9
  • 32

1 Answers1

1

Yes, you can have as many adapters as you want, but they need unique ids.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • Then how will I access the specific inbound channel adapter from my java code ? – user3548196 Jul 30 '15 at 04:50
  • 1
    "Access" it in what respect? To start/stop, see [this answer](http://stackoverflow.com/questions/23915524/spring-integration-manually-start-stop-channel-adapter-via-control-bus/23916788#23916788). You can get a reference to the `MessageSource` within the adapter with bean name `id.source`. I just noticed you have the same `id` - they must be unique. – Gary Russell Jul 30 '15 at 12:49