WSO2 ESB:如何处理端点返回的内部错误

WSO2 ESB: How to handle internal error returned by an endpoint

我正在使用 CALL 调解器在端点上调用 Get 方法。下面粘贴的端点 returns 500 内部服务器错误。但是,调解流程不会像往常一样继续进行,而不是控制转到故障序列。如何路由到故障序列?如何处理 wso2 中的内部错误?

[2020-02-14 17:51:21,175] DEBUG {org.apache.synapse.transport.http.headers} - http-incoming-1 << HTTP/1.1 500 Internal Server Error
[2020-02-14 17:51:21,175] DEBUG {org.apache.synapse.transport.http.headers} - http-incoming-1 << HTTP/1.1 500 Internal Server Error
[2020-02-14 17:51:21,176] DEBUG {org.apache.synapse.transport.http.headers} - http-incoming-1 << Strict-Transport-Security: max-age=15638400; includeSubDomains
[2020-02-14 17:51:21,176] DEBUG {org.apache.synapse.transport.http.headers} - http-incoming-1 << Strict-Transport-Security: max-age=15638400; includeSubDomains
[2020-02-14 17:51:21,177] DEBUG {org.apache.synapse.transport.http.headers} - http-incoming-1 << Access-Control-Allow-Methods: POST, GET
[2020-02-14 17:51:21,177] DEBUG {org.apache.synapse.transport.http.headers} - http-incoming-1 << Access-Control-Allow-Methods: POST, GET

WSO2 ESB 在端点 returns 500 时不会命中故障序列,因为无论响应代码如何,中介流都应该继续。我们可以检索响应的状态代码,然后触发故障序列。下面给出了一个样本序列。

<inSequence>
     <call>
        <endpoint>
           <http uri-template="http://www.mocky.io/v2/5e465018330000520002605f"/>
        </endpoint>
     </call>
     <filter source="$axis2:HTTP_SC" regex="500">
        <then>
           <sequence key="fault"/>
        </then>
        <else/>
     </filter>
     <respond/>
  </inSequence>