WSO2 - 迭代调解器。错误后应继续迭代
WSO2 - Iterate mediator. Iteration should continue after error
在WSO2 iterate mediator中,如果在一次迭代中发生错误,我希望后续迭代继续进行。我们如何确保这一点?
我已完成以下操作,但在第一个错误后执行不会继续。
<sequence xmlns="http://ws.apache.org/ns/synapse" name="IterateErrprTest" onError="onErr2Cric">
<payloadFactory media-type="xml">
<format>
<format xmlns="">
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<LIST>
<DETAIL></DETAIL>
<DETAIL></DETAIL>
</LIST>
</soapenv:Body>
</soapenv:Envelope>
</format>
</format>
</payloadFactory>
<iterate xmlns:ns="http://org.apache.synapse/xsd" continueParent="true" expression="//LIST/DETAIL" sequential="true">
<target sequence="2Cric"></target>
</iterate>
</sequence>
<!--- In my target sequence 2Cric, I have introduced an error by calling a non-existent website -->
<sequence xmlns="http://ws.apache.org/ns/synapse" name="2Cric" onError="onErr2Cric">
<log>
<property name="KKLK" value="KKLK KKLK"></property>
</log>
<callout serviceURL="http://www.cricinfo22.com">
<source type="envelope"></source>
<target key="Output"></target>
</callout>
</sequence>
<!--- The error sequence -->
<sequence xmlns="http://ws.apache.org/ns/synapse" name="onErr2Cric">
<log>
<property name="onErr2CricError" value="2Cric error has happened"></property>
</log>
</sequence>
WSO2 中的错误与Java 中的错误相似,但与java 中的异常不同。基本上,您不应该处理错误。
这意味着当迭代中介器出现错误时,它将退出循环。
我们通过围绕它进行设计来解决这个问题。我们使用 onError 属性调用与我们的错误处理序列相同的序列。但是我们不处理失败的记录。代码是这样的。
<sequence xmlns="http://ws.apache.org/ns/synapse"
name="MySequence"
onError="MySequence"
trace="enable"
statistics="enable">
<!-- Error logging is done -->
<!-- Get the list of records to process from the database excluding the ones failed -->
<!-- Our code here does not get the failed -->
在WSO2 iterate mediator中,如果在一次迭代中发生错误,我希望后续迭代继续进行。我们如何确保这一点? 我已完成以下操作,但在第一个错误后执行不会继续。
<sequence xmlns="http://ws.apache.org/ns/synapse" name="IterateErrprTest" onError="onErr2Cric">
<payloadFactory media-type="xml">
<format>
<format xmlns="">
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<LIST>
<DETAIL></DETAIL>
<DETAIL></DETAIL>
</LIST>
</soapenv:Body>
</soapenv:Envelope>
</format>
</format>
</payloadFactory>
<iterate xmlns:ns="http://org.apache.synapse/xsd" continueParent="true" expression="//LIST/DETAIL" sequential="true">
<target sequence="2Cric"></target>
</iterate>
</sequence>
<!--- In my target sequence 2Cric, I have introduced an error by calling a non-existent website -->
<sequence xmlns="http://ws.apache.org/ns/synapse" name="2Cric" onError="onErr2Cric">
<log>
<property name="KKLK" value="KKLK KKLK"></property>
</log>
<callout serviceURL="http://www.cricinfo22.com">
<source type="envelope"></source>
<target key="Output"></target>
</callout>
</sequence>
<!--- The error sequence -->
<sequence xmlns="http://ws.apache.org/ns/synapse" name="onErr2Cric">
<log>
<property name="onErr2CricError" value="2Cric error has happened"></property>
</log>
</sequence>
WSO2 中的错误与Java 中的错误相似,但与java 中的异常不同。基本上,您不应该处理错误。
这意味着当迭代中介器出现错误时,它将退出循环。
我们通过围绕它进行设计来解决这个问题。我们使用 onError 属性调用与我们的错误处理序列相同的序列。但是我们不处理失败的记录。代码是这样的。
<sequence xmlns="http://ws.apache.org/ns/synapse"
name="MySequence"
onError="MySequence"
trace="enable"
statistics="enable">
<!-- Error logging is done -->
<!-- Get the list of records to process from the database excluding the ones failed -->
<!-- Our code here does not get the failed -->