[英]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.