Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 从目录动态更改的FTP服务器下载文件_Spring_Ftp_Spring Integration - Fatal编程技术网

Spring 从目录动态更改的FTP服务器下载文件

Spring 从目录动态更改的FTP服务器下载文件,spring,ftp,spring-integration,Spring,Ftp,Spring Integration,我正在使用Spring集成从FTP服务器下载/上载文件 如何在Spring FTP:Inbound频道中动态更改remote directory=“/directory Name” 我的客户将每天创建一个文件夹,基本上是“MM-dd-yy”格式,并将所有文件复制到那里。 在“FTP:Inbound channel”中,我没有找到任何方法来配置此模式。我基本上有 在配置中硬记录目录或文件名。 我想要的是以编程方式设置路径。因为有时候我需要下载所有的文件 从目录或仅下载特定文件 我发现远程目录表达式

我正在使用Spring集成从FTP服务器下载/上载文件

如何在Spring FTP:Inbound频道中动态更改
remote directory=“/directory Name”

我的客户将每天创建一个文件夹,基本上是
“MM-dd-yy”
格式,并将所有文件复制到那里。 在“FTP:Inbound channel”中,我没有找到任何方法来配置此模式。我基本上有 在配置中硬记录目录或文件名。 我想要的是以编程方式设置路径。因为有时候我需要下载所有的文件 从目录或仅下载特定文件

我发现
远程目录表达式=“'directory'+'/'+new java.text.simpleDataFormat('dd-MM-yyyy')。格式(new java.util.Date())”
可以在FTP:Outbound频道中设置 FTP:InBound频道中是否有这样的属性

我的配置如下:

<bean id="ftpClientFactory"
    class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
    <property name="host" value="${host}" />
    <property name="port" value="${availableServerPort}" />
    <property name="username" value="${userid}" />
    <property name="password" value="${password}" />
</bean>

<int-ftp:inbound-channel-adapter id="ftpInbound"
    cache-sessions="false" channel="ftpChannel" session-factory="ftpClientFactory"
    filename-pattern="*.txt" auto-create-local-directory="true"
    delete-remote-files="false" remote-directory="/filedirectory"
    local-directory="${local_directory}">
    <int:poller fixed-rate="1000" />
</int-ftp:inbound-channel-adapter>

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

我没有找到一种方法来完成上述所有项目


请告诉我如何实现此目的。

您不能使用入站适配器实现此目的,但可以使用来实现您需要的功能;已描述

您可以使用
ls
列出文件,然后是一个
和另一个使用
get
的网关;也可以使用
mget
命令在表达式中使用文件名模式

有一个使用网关的示例