【发布时间】:2018-06-12 13:05:54
【问题描述】:
我有一个 spring-integration 流程,它从一个由事务轮询器激活的文件入站通道适配器开始(tx 由 atomikos 处理)。 处理文件中的文本并且消息在流中向下传递,直到它被发送到 JMS 队列之一(JMS outbound-channel-adapter)。 在中间,嵌套事务中有一些数据库写入。 该系统旨在 24/7 全天候运行。
碰巧单个消息流逐渐变慢,当我调查时,我发现导致延迟增加的阶段是从文件系统读取。
下面是集成流程的第一部分:
<logging-channel-adapter id="logger" level="INFO"/>
<transaction-synchronization-factory id="sync-factory">
<after-commit expression="payload.delete()" channel="after-commit"/>
</transaction-synchronization-factory>
<service-activator input-channel="after-commit" output-channel="nullChannel" ref="tx-after-commit-service"/>
<!-- typeb inbound from filesystem -->
<file:inbound-channel-adapter id="typeb-file-inbound-adapter"
auto-startup="${fs.typeb.enabled:true}"
channel="typeb-inbound"
directory="${fs.typeb.directory.in}"
filename-pattern="${fs.typeb.filter.filenamePattern:*}"
prevent-duplicates="${fs.typeb.preventDuplicates:false}" >
<poller id="poller"
fixed-delay="${fs.typeb.polling.millis:1000}"
max-messages-per-poll="${fs.typeb.polling.numMessages:-1}">
<transactional synchronization-factory="sync-factory"/>
</poller>
</file:inbound-channel-adapter>
<channel id="typeb-inbound">
<interceptors>
<wire-tap channel="logger"/>
</interceptors>
</channel>
我阅读了一些关于存储已看到文件列表的 prevent-duplicates 选项相关的问题,但事实并非如此,因为我将其关闭。 我不认为它可能与过滤器(文件名模式)有关,因为我在配置中使用的表达式(*.RCV)很容易应用,并且输入文件夹不包含很多文件(少于 100 ) 同时。
不过,随着时间的推移,有些东西会逐渐使从文件系统读取的速度越来越慢,在正常运行的几天内,从几毫秒到超过 3 秒。
有什么提示吗?
【问题讨论】: