错误阻止WSO2中的消息处理器的消息队列

时间:2014-10-31 10:45:58

标签: proxy wso2

我试图在WSO2(4.8.1)中使用消息转发处理器。

上下文如下:

1)我在消息存储区中发送了消息 2)我使用我的消息转发处理器从商店中提取消息并调用wso2代理 3)我的代理调用外部服务

我正在测试外部服务的SOAP Fault。

这是你的代码

我的消息转发处理器配置如下

<?xml version="1.0" encoding="UTF-8"?><messageProcessor xmlns="http://ws.apache.org/ns/synapse"  class="org.apache.synapse.message.processor.impl.forwarder.ScheduledMessageForwardingProcessor" name="AnotherCapForwardMessageProcessor" targetEndpoint="AnotherCapProxyEndPoint" messageStore="OperCupIDStore">
 <parameter name="message.processor.reply.sequence">AnotherCapProcessorReply</parameter>
<parameter name="max.delivery.attempts">2</parameter>
<parameter name="client.retry.interval">5000</parameter>
<parameter name="interval">5000</parameter>
<parameter name="message.processor.fault.sequence">AnotherCapProcessorFault</parameter>
<parameter name="is.active">true</parameter>

我的代理是以下

<?xml version="1.0" encoding="UTF-8"?>
  <proxy xmlns="http://ws.apache.org/ns/synapse" name="AnotherCapProxy" transports="http https" startOnLoad="true" trace="disable">
<target>
    <inSequence>
        <log level="custom">
            <property name="where" value="********** [ANOTHER-CAP-PROXY] - BEGINNING OF IN SEQUENCE .... "/>
        </log>
        <log level="full">
            <property name="what" value="********** [ANOTHER-CAP-PROXY] - MESSAGE FROM OPERCUPIDSTORE...."/>
        </log>
        <property name="FORCE_ERROR_ON_SOAP_FAULT" value="false" scope="default" type="STRING"/>
        <property name="OUT_ONLY" value="false" scope="default" type="STRING"/>
        <property name="InternalCodErr" value="WSO2_xxx" scope="default" type="STRING"/>
        <property xmlns:ns="http://org.apache.synapse/xsd" xmlns:p="http://gamopera.ifpl.csi.it" name="ProcessingID" expression="//p:id" scope="default" type="STRING"/>
        <log level="custom">
            <property xmlns:ns="http://org.apache.synapse/xsd" name="what" expression="fn:concat('****[ANOTHER-CAP-PROXY] - PROCESSING ID: ',get-property('default','ProcessingID'))"/>
        </log>
        <xslt xmlns:ns="http://org.apache.synapse/xsd" key="gov:xslt/getInputCUPXml_Transform.xslt" source="$body">
            <property name="idOp" expression="get-property('default','ProcessingID')"/>
        </xslt>
        <log level="full">
            <property name="what" value="********** [ANOTHER-CAP-PROXY] - CALLING GAMOPERA FOR THE XML REQUEST TO INVOKE SIMON.... "/>
        </log>
        <header name="Action" scope="default" value=" "/>
        <send>
            <endpoint key="AnotherCapGamoperaCreateXMLServiceEndpoint"/>
        </send>
    </inSequence>
    <outSequence>
        <log level="full">
            <property name="where" value="********** [ANOTHER-CAP-PROXY] - BEGINNING OF OUT SEQUENCE .... "/>
            <property name="where" value="********** [ANOTHER-CAP-PROXY] - THE GAMOPERA RESPONSE ...."/>
        </log>
        <filter xmlns:s12="http://www.w3.org/2003/05/soap-envelope" xmlns:ns="http://org.apache.synapse/xsd" xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xpath="s11:Body/s11:Fault | s12:Body/s12:Fault">
            <then>
                <property name="ErrorCode" value="WSO2_004" scope="operation" type="STRING"/>
                <log level="custom">
                    <property name="where" value="********** [ANOTHER-CAP-PROXY] - SOAP FAULT !!! SOMETHING WENT WRONG CALLING GAMOPERA IN GETTING XML ...."/>
                    <property name="ERROR_CODE" expression="get-property('operation','ErrorCode')"/>
                </log>
            </then>
            <else>
                <property name="ErrorCode" value="WSO2_003" scope="default" type="STRING"/>
                <log level="custom">
                    <property name="where" value="********** [ANOTHER-CAP-PROXY] - NOT COMPLETE RESPONSE FROM GAMOPERA IN GETTING XML ..."/>
                    <property name="ERROR_CODE = " expression="get-property('default','ErrorCode')"/>
                </log>
            </else>
        </filter>
        <send/>
    </outSequence>
    <faultSequence>
        <log level="full">
            <property name="where" value="********** [ANOTHER-CAP-PROXY] - BEGINNING OF FAULT SEQUENCE .... "/>
            <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
            <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
            <property name="ERROR_DETAIL" expression="get-property('ERROR_DETAIL')"/>
            <property name="ERROR_EXCEPTION" expression="get-property('ERROR_EXCEPTION')"/>
        </log>
        <send/>
    </faultSequence>
</target>
<publishWSDL key="gov:wsdl/AnotherWSDL.wsdl"/>

所以我的消息处理器尝试了两次,然后自行退出。

执行日志时是以下内容......

TID: [0] [ESB] [2014-10-31 11:00:17,128]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  where = ********** [ANOTHER-CAP-PROXY] - BEGINNING OF IN SEQUENCE ....  {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-10-31 11:00:17,128]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  To: /wso003/services/AnotherCapProxy, WSAction: urn:process, SOAPAction: urn:process, MessageID: urn:uuid:2262a521-97da-471a-8691-da9016cbeac3, Direction: request, what = ********** [ANOTHER-CAP-PROXY] - MESSAGE FROM OPERCUPIDSTORE...., Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body>
  <gam:process xmlns:gam="http://gamopera.ifpl.csi.it">
     <!--Zero or more repetitions:-->         
  <gam:id>459</gam:id></gam:process>
</soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-10-31 11:00:17,129]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  what = ****[ANOTHER-CAP-PROXY] - PROCESSING ID: 459 {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-10-31 11:00:17,132]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  To: /wso003/services/AnotherCapProxy, WSAction: urn:process, SOAPAction: urn:process, MessageID: urn:uuid:2262a521-97da-471a-8691-da9016cbeac3, Direction: request, what = ********** [ANOTHER-CAP-PROXY] - CALLING GAMOPERA FOR THE XML REQUEST TO INVOKE SIMON.... , Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body>
<p:gestWso2GetInputCUPXml xmlns:p="http://operintegrated.interfacews.operserv.gamopera.csi.it/"><input><idOperazione>459</idOperazione></input></p:gestWso2GetInputCUPXml></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-10-31 11:00:18,980]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:bf5762a3-2324-4fed-8b56-fdc7cdd4cac2, Direction: response, where = ********** [ANOTHER-CAP-PROXY] - BEGINNING OF OUT SEQUENCE .... , where = ********** [ANOTHER-CAP-PROXY] - THE GAMOPERA RESPONSE ...., Envelope: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Errore imprevisto occorso durante l'esecuzione del metodo:java.lang.NullPointerException</faultstring><detail><ns1:Exception xmlns:ns1="http://operintegrated.interfacews.operserv.gamopera.csi.it/"></ns1:Exception></detail></soap:Fault></soap:Body></soap:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-10-31 11:00:18,980]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  where = ********** [ANOTHER-CAP-PROXY] - FAULT !!! SOMETHING WENT WRONG CALLING GAMOPERA IN GETTING XML ...., ERROR_CODE = WSO2_004 {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-10-31 11:00:18,985] ERROR {org.apache.synapse.message.processor.impl.forwarder.ForwardingService} -  BlockingMessageSender of message processor [AnotherCapForwardMessageProcessor] failed to send message to the endpoint {org.apache.synapse.message.processor.impl.forwarder.ForwardingService}
TID: [0] [ESB] [2014-10-31 11:00:18,986]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  To: /wso003/services/OperCupPrepareProxy.OperCupPrepareProxyHttpSoap11Endpoint, WSAction: urn:process, SOAPAction: urn:process, MessageID: urn:uuid:4ECFA324C9FBB675AB842060829710186-582880576, Direction: request, where = ********** [ANOTHER-CAP-PROCESSOR-FAULT] - BEGINNING PROCESSOR FAULT SEQUENCE .... , Envelope: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Errore imprevisto occorso durante l'esecuzione del metodo:java.lang.NullPointerException</faultstring><detail><ns1:Exception xmlns:ns1="http://operintegrated.interfacews.operserv.gamopera.csi.it/"></ns1:Exception></detail></soap:Fault></soap:Body></soap:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-10-31 11:00:18,992]  INFO {org.apache.synapse.message.processor.impl.ScheduledMessageProcessor} -  Successfully deactivated the message processor [AnotherCapForwardMessageProcessor] {org.apache.synapse.message.processor.impl.ScheduledMessageProcessor}

我看到执行没有在消息处理器重试序列中交叉,并且当我关闭代理输出序列时可能出现问题。

有什么建议吗?非常感谢你提前!!!

再见

切萨雷

1 个答案:

答案 0 :(得分:1)

当您将soap故障发送回代理outSequence中的消息处理器时,消息处理器执行它的故障序列:HTTP消息的状态代码必须具有不同于'500'的值。你应该记录它(使用属性$ axis2:HTTP_SC)

当故障序列执行'max.delivery.attempts'次时,消息处理器被取消激活,如果您希望它无限期地重新发送消息,请将此值设置为-1