synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asan...@apache.org
Subject svn commit: r608940 - in /webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse: config/xml/SynapseXMLConfigurationFactory.java core/axis2/SynapseCallbackReceiver.java core/axis2/TimeoutHandler.java
Date Fri, 04 Jan 2008 17:52:51 GMT
Author: asankha
Date: Fri Jan  4 09:52:43 2008
New Revision: 608940

URL: http://svn.apache.org/viewvc?rev=608940&view=rev
Log:
minor enhancements to:
1. make the default "fault" sequence Log and Drop a message and in the log message indicate
that its the default fault sequence, and also include ERROR_MESSAGE and ERROR_CODE if any
are available

2. Push an ERROR_MESSAGE as "Send timeout" for timed out faults generated when an endpoint
does not reply as expected

Modified:
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseCallbackReceiver.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/TimeoutHandler.java

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java?rev=608940&r1=608939&r2=608940&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java
Fri Jan  4 09:52:43 2008
@@ -21,6 +21,7 @@
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.xpath.AXIOMXPath;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.synapse.Mediator;
@@ -36,6 +37,8 @@
 import org.apache.synapse.mediators.base.SequenceMediator;
 import org.apache.synapse.mediators.builtin.DropMediator;
 import org.apache.synapse.mediators.builtin.LogMediator;
+import org.apache.synapse.mediators.MediatorProperty;
+import org.jaxen.JaxenException;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
@@ -202,7 +205,13 @@
 
     /**
      * Return the fault sequence if one is not defined. This implementation defaults to
-     * a simple sequence with a <log level="full"/>
+     * a simple sequence :
+     * <log level="full">
+     *   <property name="MESSAGE" value="Executing default "fault" sequence"/>
+     *   <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
+     *   <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
+     * </log>
+     * <drop/>
      *
      * @param config the configuration to be updated
      */
@@ -211,7 +220,28 @@
         fault.setName(org.apache.synapse.SynapseConstants.FAULT_SEQUENCE_KEY);
         LogMediator log = new LogMediator();
         log.setLogLevel(LogMediator.FULL);
+
+        MediatorProperty mp = new MediatorProperty();
+        mp.setName("MESSAGE");
+        mp.setValue("Executing default \"fault\" sequence");
+        log.addProperty(mp);
+
+        mp = new MediatorProperty();
+        mp.setName("ERROR_CODE");
+        try {
+            mp.setExpression(new AXIOMXPath("get-property('ERROR_CODE')"));
+        } catch (JaxenException ignore) {}
+        log.addProperty(mp);
+
+        mp = new MediatorProperty();
+        mp.setName("ERROR_MESSAGE");
+        try {
+            mp.setExpression(new AXIOMXPath("get-property('ERROR_MESSAGE')"));
+        } catch (JaxenException ignore) {}
+        log.addProperty(mp);
+
         fault.addChild(log);
+        fault.addChild(new DropMediator());
         config.addSequence(org.apache.synapse.SynapseConstants.FAULT_SEQUENCE_KEY, fault);
     }
 

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseCallbackReceiver.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseCallbackReceiver.java?rev=608940&r1=608939&r2=608940&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseCallbackReceiver.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseCallbackReceiver.java
Fri Jan  4 09:52:43 2008
@@ -127,7 +127,7 @@
             } else {
                 // TODO invoke a generic synapse error handler for this message
                 log.warn("Synapse received a response for the request with message Id : "
+
-                    messageID + " But a callback has not been registered to process this
response");
+                    messageID + " But a callback is not registered (anymore) to process this
response");
             }
 
         } else if (!messageCtx.isPropertyTrue(NhttpConstants.SC_ACCEPTED)){

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/TimeoutHandler.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/TimeoutHandler.java?rev=608940&r1=608939&r2=608940&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/TimeoutHandler.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/TimeoutHandler.java
Fri Jan  4 09:52:43 2008
@@ -115,6 +115,7 @@
                                 // add an error code to the message context, so that error
sequences
                                 // can identify the cause of error
                                 msgContext.setProperty(SynapseConstants.ERROR_CODE, SynapseConstants.TIME_OUT);
+                                msgContext.setProperty(SynapseConstants.ERROR_MESSAGE, "Send
timeout");
 
                                 Stack faultStack = msgContext.getFaultStack();
 



---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


Mime
View raw message