无论如何在一个配置文件中有多个 SFTP 入站通道?

Is there anyway to have multiple SFTP inbound channel in one config file?

我有多个位置,我必须从那里下载这些文件,然后删除这些文件或将这些下载的文件存档到远程服务器上。 以下是我想做的,但问题是我知之甚少,我不知道这是否可能。

应用程序上下文:

<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> 

是的,您可以拥有任意数量的适配器,但它们需要唯一的 id 个。