camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1452014 - in /camel/branches/camel-2.10.x: ./ camel-core/src/main/java/org/apache/camel/component/direct/ camel-core/src/test/java/org/apache/camel/component/direct/
Date Sun, 03 Mar 2013 07:30:12 GMT
Author: davsclaus
Date: Sun Mar  3 07:30:12 2013
New Revision: 1452014

URL: http://svn.apache.org/r1452014
Log:
CAMEL-6105: Direct component will throw specific exception if no direct consumer is available
to process the Exchange. Thanks to Aaron Whiteside for the patch.

Added:
    camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/direct/DirectConsumerNotAvailableException.java
      - copied unchanged from r1452013, camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectConsumerNotAvailableException.java
Modified:
    camel/branches/camel-2.10.x/   (props changed)
    camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/direct/DirectProducer.java
    camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/direct/SendToNonExistingDirectEndpointTest.java

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1452013

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/direct/DirectProducer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/direct/DirectProducer.java?rev=1452014&r1=1452013&r2=1452014&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/direct/DirectProducer.java
(original)
+++ camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/direct/DirectProducer.java
Sun Mar  3 07:30:12 2013
@@ -18,7 +18,6 @@ package org.apache.camel.component.direc
 
 import org.apache.camel.AsyncCallback;
 import org.apache.camel.AsyncProcessor;
-import org.apache.camel.CamelExchangeException;
 import org.apache.camel.Exchange;
 import org.apache.camel.impl.DefaultAsyncProducer;
 import org.apache.camel.util.AsyncProcessorConverterHelper;
@@ -43,7 +42,7 @@ public class DirectProducer extends Defa
     public void process(Exchange exchange) throws Exception {
         if (endpoint.getConsumer() == null) {
             LOG.warn("No consumers available on endpoint: " + endpoint + " to process: "
+ exchange);
-            throw new CamelExchangeException("No consumers available on endpoint: " + endpoint,
exchange);
+            throw new DirectConsumerNotAvailableException("No consumers available on endpoint:
" + endpoint, exchange);
         } else {
             endpoint.getConsumer().getProcessor().process(exchange);
         }
@@ -53,7 +52,7 @@ public class DirectProducer extends Defa
         if (endpoint.getConsumer() == null) {
             LOG.warn("No consumers available on endpoint: " + endpoint + " to process: "
+ exchange);
             // indicate its done synchronously
-            exchange.setException(new CamelExchangeException("No consumers available on endpoint:
" + endpoint, exchange));
+            exchange.setException(new DirectConsumerNotAvailableException("No consumers available
on endpoint: " + endpoint, exchange));
             callback.done(true);
             return true;
         } else {

Modified: camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/direct/SendToNonExistingDirectEndpointTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/direct/SendToNonExistingDirectEndpointTest.java?rev=1452014&r1=1452013&r2=1452014&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/direct/SendToNonExistingDirectEndpointTest.java
(original)
+++ camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/direct/SendToNonExistingDirectEndpointTest.java
Sun Mar  3 07:30:12 2013
@@ -35,7 +35,8 @@ public class SendToNonExistingDirectEndp
             template.sendBody("direct:foo", "Hello World");
             fail("Should have thrown exception");
         } catch (CamelExecutionException e) {
-            CamelExchangeException cause = assertIsInstanceOf(CamelExchangeException.class,
e.getCause());
+            DirectConsumerNotAvailableException cause = assertIsInstanceOf(DirectConsumerNotAvailableException.class,
e.getCause());
+            assertIsInstanceOf(CamelExchangeException.class, cause); // ensure backwards
compatibility
             assertEquals("No consumers available on endpoint: Endpoint[direct://foo]. Exchange[Message:
Hello World]", cause.getMessage());
             assertNotNull(cause.getExchange());
         }



Mime
View raw message