[英]How to avoid ignore the next mediator using response mediator in WSO2 EI?
我有一個REST服務,它返回一個簡單的json {message:“ ok”}。 當我使用Respond Mediator時,這將停止對消息的進一步處理,並將消息發送回客戶端。
我需要將響應發送到客戶端,然后異步執行任務,但是如果使用它,它將忽略對序列或端點的下一次調用。
如何在不響應中介者忽略下一個中介者的情況下,如何同步響應(響應客戶端)然后調用服務?
謝謝;
我能夠解決挑戰。 有效地克隆介體不僅可以克隆消息,還可以為新消息賦予新的生命。
<api xmlns="http://ws.apache.org/ns/synapse" name="porticApiAsyn" context="/test">
<resource methods="POST" url-mapping="/asyn">
<inSequence>
<log>
<property name="message" value="asyn"/>
</log>
<payloadFactory media-type="json">
<format>{"message":"asyn test"}</format>
<args/>
</payloadFactory>
<clone continueParent="true" sequential="true">
<target sequence="logSequence"/>
</clone>
<respond/>
</inSequence>
在這種情況下,將消息發送到對數序列,然后執行響應介體。 謝謝你的幫助。
對於您的情況,您甚至可以執行以下操作
<api xmlns="http://ws.apache.org/ns/synapse" name="porticApiAsyn" context="/test">
<resource methods="POST" url-mapping="/asyn">
<inSequence>
<log>
<property name="message" value="asyn"/>
</log>
<payloadFactory media-type="json">
<format>{"message":"asyn test"}</format>
<args/>
</payloadFactory>
<clone continueParent="true" sequential="true">
<target sequence="logSequence"/>
<target>
<sequence>
<respond/>
</sequence>
</target>
</clone>
</inSequence>
我想它應該也可以工作,並且可讀性更好
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.