我正在尝试创建一个集成流程,其中将执行以下操作:
我已经设计了一个粗略的整合流程,直到第7步:
<bean id="jsonToFilenamesMapper"/>
<bean id="sampleFileSplitter"/>
<bean id="dateBasedFilter"/>
<bean id="customMapper"/>
<bean id="em"/>
<bean id="randomCronTrigger"/>
<bean id="sampleFileNameSplitter"/>
<bean id="sampleFileActivator"/>
<int:channel id="input"/>
<int:channel id="output"/>
<int:channel id="filenames"/>
<int:channel id="reply"/>
<int:channel id="csvout"/>
<int:channel id="line"/>
<int:channel id="extractModel"/>
<int:channel id="afterSaving"/>
<int:channel id="filename"/>
<int-http:outbound-gateway request-channel="input"
reply-channel="output"
url=" https://download.com/files/"
http-method="GET"
expected-response-type="java.lang.String">
</int-http:outbound-gateway>
<int:inbound-channel-adapter channel="input" expression="''">
<int:poller trigger="randomCronTrigger">
</int:poller>
</int:inbound-channel-adapter>
<int:json-to-object-transformer input-channel="output"
output-channel="filenames"
type="sample.integration.FileInfo"
object-mapper="jsonToFileInfoMapper">
</int:json-to-object-transformer>
<int:service-activator ref="sampleFileActivator"
input-channel="filenames"
output-channel="filename">
</int:service-activator>
<int-http:outbound-gateway request-channel="reply"
reply-channel="csvout"
url=" https://download.com/files/{filename}"
http-method="GET"
expected-response-type="java.lang.String">
<int-http:uri-variable name="filename" expression="payload.filename"/>
</int-http:outbound-gateway>
<int:splitter input-channel="csvout"
output-channel="line"
ref="sampleFileSplitter">
</int:splitter>
<int:json-to-object-transformer input-channel="line"
output-channel="extractModel"
object-mapper="customMapper">
</int:json-to-object-transformer>
<int-jpa:updating-outbound-gateway request-channel="extractModel"
reply-channel="afterSaving"
persist-mode="PERSIST"
entity-manager="em">
</int-jpa:updating-outbound-gateway>
所以我的问题是:
答案 0 :(得分:0)
一切都很好看。你走对了路。
我将分割器的输出通道设为ExecutorChannel
,以便让分割的项目并行处理。
您的JPA网关应该向聚合器发送回复。只有聚合器才能执行文件删除。由于之前有分割器,因此只需依赖聚合器的默认值即可。
我认为通过Java DSL表示您的流程没有任何障碍。优点是代码更少,没有额外的渠道。虽然使用此xml配置,但您可以使用<chain>
进行简化。