Spring integration 正在使用Spring集成读取文件,并希望使用过滤器进行排序和文件提取
我正在尝试实现一个场景,其中运行在Kubernetes环境中多个pod上的spring集成应用程序尝试从一个目录读取文件Spring integration 正在使用Spring集成读取文件,并希望使用过滤器进行排序和文件提取,spring-integration,spring-integration-sftp,Spring Integration,Spring Integration Sftp,我正在尝试实现一个场景,其中运行在Kubernetes环境中多个pod上的spring集成应用程序尝试从一个目录读取文件 读取时,我正在对文件应用锁,但应用锁后,我无法处理文件并重命名或将文件移动到其他文件夹。 文件:nio locker/ 一旦释放锁,我就能够读取文件并处理文件 为了避免任何冲突,在释放锁后,两个实例读取相同的数据文件,我想创建一个带有文件名和前缀_processing的临时文件 因此,任何从目录中读取文件以进行处理的文件适配器都不应读取具有另一个文件名和_process
文件:nio locker/
B读取文件并锁定。
C使用文件名和处理前缀创建临时文件。
d解锁文件并使用转换器和批处理作业对其进行处理。
E从目录中读取文件的另一个pod将检查未锁定且没有临时文件的文件
<file:inbound-channel-adapter
channel="input"
directory="C:/Users/*****/TestFileIntegration/inputWithData"
auto-startup="true"
prevent-duplicates="true"
queue-size="10"
use-watch-service="true">
<int:poller id="poller" fixed-delay="1" />
<file:nio-locker/>
</file:inbound-channel-adapter>
我需要两点帮助1。以某种方式读取文件时,代码首先选择最旧的文件,最新的文件将保留。
2。筛选并读取没有名为fileName\u Processing且未锁定的临时文件的文件。请考虑不要使用
,而是使用共享的元数据存储配置FileSystemTempersistentAcceptOnCefileListFilter
。因此,应用程序的每个实例都将在对文件进行轮询之前首先查阅该存储。如果文件有条目,则当前实例将跳过该条目:
对于您要查找的订单,在
上有一个比较器选项:
<file:inbound-channel-adapter
channel="input"
directory="C:/Users/*****/TestFileIntegration/inputWithData"
auto-startup="true"
prevent-duplicates="true"
queue-size="10"
use-watch-service="true">
<int:poller id="poller" fixed-delay="1" />
<file:nio-locker/>
</file:inbound-channel-adapter>
<xsd:attribute name="comparator" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[
Specify a Comparator to be used when ordering Files. If none is provided, the
order will be determined by the java.io.File implementation of Comparable. MUTUALLY EXCLUSIVE with queue-size.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>