Author: ffang
Date: Tue May  7 08:12:41 2013
New Revision: 1479803

URL: http://svn.apache.org/r1479803
Log:
[SMX4-1452]introduce a throwExceptionOnFailure parameter for camel-nmr producer 
endpoint

Modified:
    
servicemix/smx4/features/trunk/camel/servicemix-camel/src/main/java/org/apache/servicemix/camel/nmr/ServiceMixEndpoint.java
    
servicemix/smx4/features/trunk/camel/servicemix-camel/src/main/java/org/apache/servicemix/camel/nmr/ServiceMixProducer.java

Modified: 
servicemix/smx4/features/trunk/camel/servicemix-camel/src/main/java/org/apache/servicemix/camel/nmr/ServiceMixEndpoint.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/camel/servicemix-camel/src/main/java/org/apache/servicemix/camel/nmr/ServiceMixEndpoint.java?rev=1479803&r1=1479802&r2=1479803&view=diff
==============================================================================
--- 
servicemix/smx4/features/trunk/camel/servicemix-camel/src/main/java/org/apache/servicemix/camel/nmr/ServiceMixEndpoint.java
 (original)
+++ 
servicemix/smx4/features/trunk/camel/servicemix-camel/src/main/java/org/apache/servicemix/camel/nmr/ServiceMixEndpoint.java
 Tue May  7 08:12:41 2013
@@ -35,11 +35,13 @@ public class ServiceMixEndpoint extends 
     private static final String SYNCHRONOUS = "synchronous";
     public static final String RUN_AS_SUBJECT = "runAsSubject";
     private static final String TIMEOUT = "timeout";
+    private static final String THROW_EXCEPTION_ON_FAILURE = 
"throwExceptionOnFailure";
     private static final Long DEFAULT_TIMEOUT = new Long(0);
 
     private String endpointName;
     private boolean synchronous;
     private boolean runAsSubject;
+    private boolean throwExceptionOnFailure = true;
     private Long timeOut = DEFAULT_TIMEOUT;
 
     public ServiceMixEndpoint(ServiceMixComponent component, String uri, 
String endpointName) {
@@ -51,6 +53,7 @@ public class ServiceMixEndpoint extends 
     public void configureProperties(Map<String, Object> options) {
         synchronous = Boolean.valueOf((String) options.remove(SYNCHRONOUS));
         runAsSubject = Boolean.valueOf((String) 
options.remove(RUN_AS_SUBJECT));
+        setThrowExceptionOnFailure(Boolean.valueOf((String) 
options.remove(THROW_EXCEPTION_ON_FAILURE)));
         timeOut = parseLongOption(options, TIMEOUT);
     }
 
@@ -103,4 +106,12 @@ public class ServiceMixEndpoint extends 
     public String getEndpointName() {
         return endpointName;
     }
+
+    public boolean isThrowExceptionOnFailure() {
+        return throwExceptionOnFailure;
+    }
+
+    public void setThrowExceptionOnFailure(boolean throwExceptionOnFailure) {
+        this.throwExceptionOnFailure = throwExceptionOnFailure;
+    }
 }

Modified: 
servicemix/smx4/features/trunk/camel/servicemix-camel/src/main/java/org/apache/servicemix/camel/nmr/ServiceMixProducer.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/camel/servicemix-camel/src/main/java/org/apache/servicemix/camel/nmr/ServiceMixProducer.java?rev=1479803&r1=1479802&r2=1479803&view=diff
==============================================================================
--- 
servicemix/smx4/features/trunk/camel/servicemix-camel/src/main/java/org/apache/servicemix/camel/nmr/ServiceMixProducer.java
 (original)
+++ 
servicemix/smx4/features/trunk/camel/servicemix-camel/src/main/java/org/apache/servicemix/camel/nmr/ServiceMixProducer.java
 Tue May  7 08:12:41 2013
@@ -22,7 +22,6 @@ import org.apache.camel.impl.DefaultProd
 import org.apache.camel.Exchange;
 import org.apache.servicemix.nmr.api.*;
 import org.apache.servicemix.nmr.api.service.ServiceHelper;
-import org.apache.servicemix.nmr.core.util.UuidGenerator;
 
 import java.util.Collections;
 import java.util.Map;
@@ -122,7 +121,8 @@ public class ServiceMixProducer extends 
      * - finishing the NMR Exchange MEP
      */
     private void handleResponse(Exchange exchange, Channel client, 
org.apache.servicemix.nmr.api.Exchange e) {
-        if (e.getError() != null) {
+        
+        if (e.getError() != null && getEndpoint().isThrowExceptionOnFailure()) 
{
             handleErrorResponse(exchange, client, e);
         } else {
             handleSuccessResponse(exchange, client, e);


Reply via email to