如何处理wso2esb和wso2dss中的端点故障

如何处理wso2esb和wso2dss中的端点故障,wso2,wso2esb,wso2carbon,Wso2,Wso2esb,Wso2carbon,我使用wso2dss创建了用于数据插入的代理服务,因此服务运行良好,对此我非常满意。但是,当wso2dss中发生任何数据复制错误时,我需要在wso2esb中处理它,因此我将此属性保留在wso2esb中,用于dss级别的错误处理: <property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/> 那我该怎么做呢? 如果我删除该属性,我将无法处理DSS级别的消息,并且即使我的用户没有收到任何响应,我也会收到如下错误: [2014-0

我使用wso2dss创建了用于数据插入的代理服务,因此服务运行良好,对此我非常满意。但是,当wso2dss中发生任何数据复制错误时,我需要在wso2esb中处理它,因此我将此属性保留在wso2esb中,用于dss级别的错误处理:

 <property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/> 
那我该怎么做呢? 如果我删除该属性,我将无法处理DSS级别的消息,并且即使我的用户没有收到任何响应,我也会收到如下错误:

[2014-03-07 11:20:51,816] ERROR - NativeWorkerPool Uncaught exception
java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFault
at org.apache.axiom.soap.impl.llom.SOAPBodyImpl.getFault(SOAPBodyImpl.java:120)
at org.apache.synapse.util.POXUtils.convertSOAPFaultToPOX(POXUtils.java:46)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:91)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:308)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:92)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:114)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:232)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:443)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:166)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:222)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:679)
所以30秒是如此重要,它会导致我客户的数据丢失。如何避免端点失败

wso2dss中的实际错误为:

Nested Exception:-
org.postgresql.util.PSQLException: ERROR: column "deviceid" is of type bigint but expression is of type character varying
  Hint: You will need to rewrite or cast the expression.
  Position: 81

    at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:105)
    at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:110)
    at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.getReader(DSOMDataSource.java:116)
    at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getDirectReader(OMSourcedElementImpl.java:225)
    ... 41 more

我在wso2esb fault中处理它,并且工作正常,但是端点失败是不可修补的

如果您想在ESB中配置DSS端点的挂起行为,请参阅文档


如果您删除了FORCE\u ERROR\u ON\u SOAP\u FAULT属性,您应该仍然能够按照ESB代理的顺序处理DSS响应中的SOAP错误。

yo可以使用端点中的此配置禁用该配置:

<?xml version="1.0"?>
<endpoint>
  <address uri="http://localhost:9000/services/SimpleStockQuoteService">
    <timeout>
      <duration>30000</duration>
      <responseAction>fault</responseAction>
    </timeout>
    <suspendOnFailure>
      <errorCodes>-1</errorCodes>
      <initialDuration>0</initialDuration>
      <progressionFactor>1.0</progressionFactor>
      <maximumDuration>0</maximumDuration>
    </suspendOnFailure>
    <markForSuspension>
      <errorCodes>-1</errorCodes>
    </markForSuspension>
  </address>
</endpoint>

30000
过错
-1
0
1
0
-1

我自己发现了这个错误,识别它并找到处理它的方法非常糟糕。在处理返回的soap错误时,WSO2 ESB的旧版本(版本4.8.1中存在此问题)中似乎存在一个bug

您可以看到@JorgeInfanteOsorio禁用端点挂起的答案,但您需要解决“未捕获异常”问题。我发现可以从故障消息中检索参数,然后“清除”当前有效负载,因此任何后续调用都不会返回异常问题

例如:

<!--
    After we call a webservice on DSS or other webservice we check if the message contains a fault message
-->
<property xmlns:s="http://www.w3.org/2003/05/soap-envelope"
         name="return_fault"
         expression="/s:Envelope/s:Body/s:Fault"/>

<filter source="boolean(get-property('return_payzen_fault'))" regex="true">
    <then>
    <!--
        There is a fault message on the payload...
    -->

        <!--
            Retrieve the information from the fault message. How you will access it and which information you will retrieve may be different depending if the answer comes from a third part webservice or from your own DSS.
        -->
        <property xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" name="code" expression="/s:Envelope/s:Body/s:Fault/s:Code/s:faultcode"/>
        <property xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" name="code" expression="/s:Envelope/s:Body/s:Fault/s:Code/s:faultstring"/>

        <!--
             Clear the payload containing the fault message
          -->
         <payloadFactory media-type="xml">
            <format>
               <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
                  <soapenv:Body/>
               </soapenv:Envelope>
            </format>
            <args/>
         </payloadFactory>

        <!--
             Now you can proceed and process the message as usual without getting the exception. You may probably use the parameters stored in the properties at the beginning to determine which error occured and what you are going to do next.
        -->

    </then>
</filter>
<!--
    There is no fault message, you can proceed with the message processing here.
-->

<?xml version="1.0"?>
<endpoint>
  <address uri="http://localhost:9000/services/SimpleStockQuoteService">
    <timeout>
      <duration>30000</duration>
      <responseAction>fault</responseAction>
    </timeout>
    <suspendOnFailure>
      <errorCodes>-1</errorCodes>
      <initialDuration>0</initialDuration>
      <progressionFactor>1.0</progressionFactor>
      <maximumDuration>0</maximumDuration>
    </suspendOnFailure>
    <markForSuspension>
      <errorCodes>-1</errorCodes>
    </markForSuspension>
  </address>
</endpoint>
<!--
    After we call a webservice on DSS or other webservice we check if the message contains a fault message
-->
<property xmlns:s="http://www.w3.org/2003/05/soap-envelope"
         name="return_fault"
         expression="/s:Envelope/s:Body/s:Fault"/>

<filter source="boolean(get-property('return_payzen_fault'))" regex="true">
    <then>
    <!--
        There is a fault message on the payload...
    -->

        <!--
            Retrieve the information from the fault message. How you will access it and which information you will retrieve may be different depending if the answer comes from a third part webservice or from your own DSS.
        -->
        <property xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" name="code" expression="/s:Envelope/s:Body/s:Fault/s:Code/s:faultcode"/>
        <property xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" name="code" expression="/s:Envelope/s:Body/s:Fault/s:Code/s:faultstring"/>

        <!--
             Clear the payload containing the fault message
          -->
         <payloadFactory media-type="xml">
            <format>
               <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
                  <soapenv:Body/>
               </soapenv:Envelope>
            </format>
            <args/>
         </payloadFactory>

        <!--
             Now you can proceed and process the message as usual without getting the exception. You may probably use the parameters stored in the properties at the beginning to determine which error occured and what you are going to do next.
        -->

    </then>
</filter>
<!--
    There is no fault message, you can proceed with the message processing here.
-->