You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2008/09/04 09:00:42 UTC

svn commit: r691885 - /servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelJbiEndpoint.java

Author: gnodet
Date: Thu Sep  4 00:00:41 2008
New Revision: 691885

URL: http://svn.apache.org/viewvc?rev=691885&view=rev
Log:
SM-1473: Camel Service Engine Component not handling error from Camel processing

Modified:
    servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelJbiEndpoint.java

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelJbiEndpoint.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelJbiEndpoint.java?rev=691885&r1=691884&r2=691885&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelJbiEndpoint.java (original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelJbiEndpoint.java Thu Sep  4 00:00:41 2008
@@ -91,18 +91,44 @@
                 }
                 JbiExchange camelExchange = new JbiExchange(camelEndpoint.getCamelContext(), binding, exchange);
                 camelProcessor.process(camelExchange);
-                done(exchange);
+                if (camelExchange.isFailed()) {
+                    Throwable t = camelExchange.getException();
+                    Exception e;
+                    if (t == null) {
+                        e = new Exception("Unknown error");
+                    } else if (t instanceof Exception) {
+                        e = (Exception) t;
+                    } else {
+                        e = new Exception(t);
+                    }
+                    fail(exchange, e);
+                } else {
+                    done(exchange);
+                }
             } else {
                 if (logger.isDebugEnabled()) {
                     logger.debug("Received exchange: " + exchange);
                 }
                 JbiExchange camelExchange = new JbiExchange(camelEndpoint.getCamelContext(), binding, exchange);
                 camelProcessor.process(camelExchange);
-                boolean txSync = exchange.isTransacted() && Boolean.TRUE.equals(exchange.getProperty(JbiConstants.SEND_SYNC));
-                if (txSync) {
-                    sendSync(exchange);
+                if (camelExchange.isFailed()) {
+                    Throwable t = camelExchange.getException();
+                    Exception e;
+                    if (t == null) {
+                        e = new Exception("Unknown error");
+                    } else if (t instanceof Exception) {
+                        e = (Exception) t;
+                    } else {
+                        e = new Exception(t);
+                    }
+                    fail(exchange, e);
                 } else {
-                    send(exchange);
+                    boolean txSync = exchange.isTransacted() && Boolean.TRUE.equals(exchange.getProperty(JbiConstants.SEND_SYNC));
+                    if (txSync) {
+                        sendSync(exchange);
+                    } else {
+                        send(exchange);
+                    }
                 }
             }
         // This is not compliant with the default MEPs