呼叫一个服务激活器和另一个服务激活器

时间:2018-12-07 13:04:58

标签: java spring spring-integration

我对Spring Integration Flow有疑问。我们可以将int:service-activator称为另一个。考虑下面的示例。

<int:channel id="getPresciption" />
<int:channel id="respPrescription" />       

<int-http:inbound-gateway
    request-channel="getPresciption" reply-channel="respPrescription"
    supported-methods="GET" path="/getAllPresciption">

    <int-http:request-mapping
        consumes="application/json" produces="application/json" />
</int-http:inbound-gateway>

<int:service-activator
    ref="medicineServiceActivator" method="buildPrescription"
    input-channel="respPrescription"  output-channel="respPrescription" />

<int:service-activator
    ref="medicineServiceActivator" method="storePrescription"
    input-channel="respPrescription"></int:service-activator>   

我的问题是我们能做到吗? 否则我们必须使用Aggregator。

1 个答案:

答案 0 :(得分:2)

您需要另一个频道

<int:service-activator
    ref="medicineServiceActivator" method="buildPrescription"
    input-channel="respPrescription"  output-channel="toStorePrescription" />

<int:service-activator
    ref="medicineServiceActivator" method="storePrescription"
    input-channel="toStorePrescription"></int:service-activator>