Spring 没有聚合的集成并行处理
Spring Integration Parallel Processing without Aggreagation
我找不到关于此的 enough/clear 文档。
我收到来自 chain processing
的消息。频道收到消息后,我想有条件地复制消息。
简单流程:
<int-http:inbound-gateway request-channel="httpRequestChannel" reply-channel="httpResponseChannel" supported-methods="POST"
path="/doSomething" request-payload-type="com.xxx.Request" >
</int-http:inbound-gateway>
<int:chain id="msgChain" input-channel="httpRequestChannel" output-channel="processChannel">
<int:claim-check-in message-store="messageStore"/>
//do something
</int:chain>
<int:chain id="msgChain2" input-channel="processChannel" output-channel="parallelChannel">
<int:claim-check-in message-store="messageStore"/>
//do something
</int:chain>
<int:chain id="parallelChainId" input-channel="parallelChannel" output-channel="httpResponseChannel">
<int:claim-check-in message-store="messageStore"/>
if(payload infrom3rdparty property set i.e. payload.infrom3rdparty == true){
send this message to //3party Channel
}
//do something
</int:chain>
我无法应用 filter
,因为丢弃消息会转到 if else
等不同的渠道。但我只需要 if
将消息复制到另一个频道
或许您可以尝试使用具有 2 个订阅者的发布-订阅频道:
- 遵循的标准流程
- 复制流程
在重复流程中,您可以使用过滤器来选择是否应发送消息。可能是这样的:
<int:publish-subscribe-channel id="parallelChannel"/>
<int:chain id="standardFlowChain" input-channel="parallelChannel" output-channel="httpResponseChannel">
<int:claim-check-in message-store="messageStore"/>
//follow the standard flow
</int:chain>
<int:chain id="thirdPartyFlowChain" input-channel="parallelChannel" output-channel="thirdPartyOutputChannel">
<int:claim-check-in message-store="messageStore"/>
<int:filter expression="payload.infrom3rdparty == true"/>
</int:chain>
我找不到关于此的 enough/clear 文档。
我收到来自 chain processing
的消息。频道收到消息后,我想有条件地复制消息。
简单流程:
<int-http:inbound-gateway request-channel="httpRequestChannel" reply-channel="httpResponseChannel" supported-methods="POST"
path="/doSomething" request-payload-type="com.xxx.Request" >
</int-http:inbound-gateway>
<int:chain id="msgChain" input-channel="httpRequestChannel" output-channel="processChannel">
<int:claim-check-in message-store="messageStore"/>
//do something
</int:chain>
<int:chain id="msgChain2" input-channel="processChannel" output-channel="parallelChannel">
<int:claim-check-in message-store="messageStore"/>
//do something
</int:chain>
<int:chain id="parallelChainId" input-channel="parallelChannel" output-channel="httpResponseChannel">
<int:claim-check-in message-store="messageStore"/>
if(payload infrom3rdparty property set i.e. payload.infrom3rdparty == true){
send this message to //3party Channel
}
//do something
</int:chain>
我无法应用 filter
,因为丢弃消息会转到 if else
等不同的渠道。但我只需要 if
将消息复制到另一个频道
或许您可以尝试使用具有 2 个订阅者的发布-订阅频道: - 遵循的标准流程 - 复制流程
在重复流程中,您可以使用过滤器来选择是否应发送消息。可能是这样的:
<int:publish-subscribe-channel id="parallelChannel"/>
<int:chain id="standardFlowChain" input-channel="parallelChannel" output-channel="httpResponseChannel">
<int:claim-check-in message-store="messageStore"/>
//follow the standard flow
</int:chain>
<int:chain id="thirdPartyFlowChain" input-channel="parallelChannel" output-channel="thirdPartyOutputChannel">
<int:claim-check-in message-store="messageStore"/>
<int:filter expression="payload.infrom3rdparty == true"/>
</int:chain>