Java SI+;观察者模式
我有一个使用spring集成的代码库Java SI+;观察者模式,java,spring-integration,Java,Spring Integration,我有一个使用spring集成的代码库 <integration-ftp:inbound-channel-adapter id="ftpInbound" channel="ftpChannel" session-factory="ftpClientFactory" filter="myCustomFilter
<integration-ftp:inbound-channel-adapter id="ftpInbound"
channel="ftpChannel"
session-factory="ftpClientFactory"
filter="myCustomFilter"
auto-create-local-directory="true"
delete-remote-files="false"
remote-directory="/foo/bar"
local-directory="file:output">
<integration:poller fixed-rate="5000" max-messages-per-poll="-1"/>
</integration-ftp:inbound-channel-adapter>
<integration:channel id="ftpChannel">
<integration:queue />
</integration:channel>
<integration:service-activator id="mySA" method="handleMessage" input-channel="ftpChannel" output-channel="outputChannel" ref="myDataGetter">
<integration:poller fixed-rate="1000" max-messages-per-poll="-1"/>
</integration:service-activator>
现在我的目标是获取最新的3个文件,即数据文件1、2和3的20130816版本。
因此,我在handleMessage方法中获得了一个逻辑构建,用于构建包含这3个文件的最新版本的HashMap。它使用一种简单的逻辑来完成,即迭代数据列表,并将subject中的文件与其进行比较。经过几次迭代,我得到了HashMap构建,其中包含最新的3个文件
现在我的下一个要求是通过通道将这3个文件传递给下一个bean
但是,应该从通道读取数据的bean应该只在HashMap完全使用最新的3个数据文件构建时读取。
在SI中是否有什么可以做到的,以便只有在处理完所有传入数据并过滤掉一组数据后,数据才能放入下一个通道
我可以考虑让myDataGetter作为Observable,让下一个通道的bean作为observer。但它不适合SI中的工作方式
任何评论?您可以将
与自定义发布策略一起使用。您可以将
与自定义发布策略一起使用
data_file1.20130816
data_file1.20130815
data_file1.20130814
data_file2.20130816
data_file2.20130815
data_file2.20130814
data_file3.20130816
data_file3.20130815
data_file3.20130814