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

时间:2014-03-07 06:23:40

标签: wso2 wso2esb wso2carbon

我使用wso2dss创建代理服务以进行数据插入,因此服务正常工作我很满意。但是当wso2dss中出现任何数据重复错误时,我需要在wso2esb中处理它,所以我将此属性保存在wso2esb中以获取dss级错误句柄:

 <property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/> 

所以它工作正常我得到50000代码使用这个我能够处理错误,而这个错误我的esb显示此消息:

[2014-03-07 11:22:40,778] INFO - LogMediator To: /services/GeoLocationInsertion, MessageID: urn:uuid:b51629e2-934e-4227-8f50-65fd9f719b8e, Direction: request, userid = -1212807836, username = sa|214057357158656, password = sa
[2014-03-07 11:22:40,783] INFO - LogMediator To: /services/ServiceLogin, MessageID: urn:uuid:1967bde1-d820-46f9-957d-55fbb6f7ea9e, Direction: request, usercode = sa, clientid = 214057357158656
[2014-03-07 11:22:40,833] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:24aea5ed-f4e2-4214-809b-b3101031edf7, Direction: response, faisal = true
[2014-03-07 11:22:40,838] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:42a17360-cd04-43bc-83ef-1f53b639de11, Direction: response, kk = true
[2014-03-07 11:22:40,853] WARN - EndpointContext Endpoint : endpoint_71f1485e740c2b97ec407fe4d3bf86929122480f208b6642 will be marked SUSPENDED as it failed
[2014-03-07 11:22:40,853] WARN - EndpointContext Suspending endpoint : endpoint_71f1485e740c2b97ec407fe4d3bf86929122480f208b6642 - last suspend duration was : 30000ms and current suspend duration is : 30000ms - Next retry after : Fri Mar 07 11:23:10 IST 2014
[2014-03-07 11:22:40,856] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:42a17360-cd04-43bc-83ef-1f53b639de11, Direction: response, MESSAGE = Executing default 'fault' sequence, ERROR_CODE = 500000, ERROR_MESSAGE = null
[2014-03-07 11:22:40,857] INFO - LogMediator To: , WSAction: , SOAPAction: , MessageID: urn:uuid:42a17360-cd04-43bc-83ef-1f53b639de11, Direction: response, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ResponseJSON><Body><Data><Exception>duplicate key value violates or The system is attempting to access an inactive service </Exception></Data></Body><Status>500000</Status></ResponseJSON></soapenv:Body></soapenv:Envelope> 

以上错误消息表示我的终端在30秒后进入挂起模式,它将自动处于活动模式。

如果任何用户同时尝试,则无法插入正确的数据,并且由于端点不可用而导致数据丢失。那么我们如何将端点保持在活动模式? 如果出现任何其他错误,则此问题不会引发:

[2014-03-07 11:22:40,853] WARN - EndpointContext Suspending endpoint : endpoint_71f1485e740c2b97ec407fe4d3bf86929122480f208b6642 - last suspend duration was : 30000ms and current suspend duration is : 30000ms - Next retry after : Fri Mar 07 11:23:10 IST 2014 

那我该怎么办呢? 如果我删除该属性,我无法处理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故障中处理它并且工作正常但是端点故障是无法解决的

3 个答案:

答案 0 :(得分:0)

如果要在ESB中配置DSS端点的暂停行为,请参阅Endpoint Error Handling文档。

如果删除FORCE_ERROR_ON_SOAP_FAULT属性,您仍然可以在ESB代理的外部序列中处理DSS响应中的soap错误。

答案 1 :(得分:0)

你可以在端点中使用此配置禁用该配置:

<?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>

答案 2 :(得分:0)

我自己想出了这个错误,识别它并找到一种使用它的方法很糟糕。在处理返回的soap故障时,似乎旧版本的WSO2 ESB中存在一个错误(我们在版本4.8.1中遇到此问题)。

你可以看到@JorgeInfanteOsorio的答案来禁用端点暂停,但是你需要一个解决方法来解决&#34; Uncaught exception&#34;问题。我发现可以从故障消息中检索参数然后清除&#34;当前的有效负载,因此任何后续调用都不会返回异常问题。

示例:

<!--
    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.
-->