<int:chain input-channel="request" output-channel="response">
<int:service-activator method="create" ref="ServiceImpl" />
<int:service-activator method="update" ref="ServiceImpl" />
<int:service-activator method="cancel" ref="ServiceImpl" />
</int:chain>
所以我正在学习spring集成,并遇到问题如何解决调用哪种服务方法?我尝试使用路由器并使用了表达式:
<int:router input-channel="inputChannel" expression="payload.type">
<int:mapping value="CREATE" channel="create"/>
<int:mapping value="UPDATE" channel="update"/>
<int:mapping value="CANCEL" channel="cancel"/>
</int:router>
也许有办法把它解决成链?
答案 0 :(得分:0)
抱歉,不清楚你在问什么。 router
类似if...else
,根据传入数据确定下一个处理步骤。 chain
就像一个公共API,可以调用几个方法:下一个方法将在前一个方法之后调用。你的how to resolve which service method to call
某种程度上与链条无关。路由器部分很好,但链没有任何动态分辨率