从包含多个文件的sftp入站消息源聚合一条消息的最佳解决方案是什么?我们有远程机器3需要接收的文件 . 之后,我们将这些文件的内容组合到一个json消息中并向前发送 .
public IntegrationFlow sftpIntegrationFlowBean() {
final Map<String, Object> headers = new HashMap<>();
headers.put("sftpFile", "sftpFile");
final Consumer<AggregatorSpec> aggregator = t -> {
t.sendPartialResultOnExpiry(true);
t.expireGroupsUponCompletion(true);
t.processor(new CustomMessageAggregator());
};
return IntegrationFlows
.from(sftpInboundMessageSource(),
e -> e.id("sftpIntegrationFlow").poller(pollerMetadataSftp))
.enrichHeaders(headers).aggregate(aggregator)
.handle(customMessageSender).get();
}
Poller民意调查每15分钟一次 . 在运行此代码时,接下来会发生:
-
检索文件并处理其中一个文件
-
15分钟后处理第二个文件
-
再过15分钟后,处理第三个文件
-
最后15分钟后消息被发送到目的地
如何在一次操作中完成所有操作而不会延误?我尝试使用FileReadingMessageSource,但结果相同 .
先感谢您 .
1 回答
增加
PollerMetadata
中的maxMessagesPerPoll
.