You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/09/03 12:15:04 UTC
svn commit: r810861 - in /camel/trunk:
camel-core/src/main/java/org/apache/camel/management/mbean/
camel-core/src/main/java/org/apache/camel/model/
camel-core/src/main/java/org/apache/camel/processor/
camel-core/src/test/java/org/apache/camel/processor...
Author: davsclaus
Date: Thu Sep 3 10:15:03 2009
New Revision: 810861
URL: http://svn.apache.org/viewvc?rev=810861&view=rev
Log:
CAMEL-1984: multicast/splitter can now be stopped when first exception occurred during processing. Fixed CS.
Added:
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastNoStopOnExceptionTest.java (with props)
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastParallelNoStopOnExceptionTest.java (with props)
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastParallelStopOnExceptionTest.java (with props)
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastStopOnExceptionTest.java (with props)
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterNoStopOnExceptionTest.java (with props)
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterParallelNoStopOnExceptionTest.java (with props)
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterParallelStopOnExceptionTest.java (with props)
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterStopOnExceptionTest.java (with props)
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastNoStopOnExceptionTest.java (with props)
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastStopOnExceptionTest.java (with props)
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitterNoStopOnExceptionTest.java (with props)
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitterStopOnExceptionTest.java (with props)
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastNoStopOnExceptionTest.xml (with props)
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastStopOnExceptionTest.xml (with props)
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterNoStopOnExceptionTest.xml (with props)
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterStopOnExceptionTest.xml
- copied, changed from r810777, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/choice.xml
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedProcessor.java
camel/trunk/camel-core/src/main/java/org/apache/camel/model/MulticastDefinition.java
camel/trunk/camel-core/src/main/java/org/apache/camel/model/SplitDefinition.java
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedProcessor.java?rev=810861&r1=810860&r2=810861&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedProcessor.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedProcessor.java Thu Sep 3 10:15:03 2009
@@ -18,11 +18,10 @@
import org.apache.camel.CamelContext;
import org.apache.camel.Processor;
-import org.apache.camel.ServiceStatus;
import org.apache.camel.Route;
+import org.apache.camel.ServiceStatus;
import org.apache.camel.impl.ServiceSupport;
import org.apache.camel.model.ProcessorDefinition;
-import org.apache.camel.model.RouteDefinition;
import org.springframework.jmx.export.annotation.ManagedAttribute;
import org.springframework.jmx.export.annotation.ManagedResource;
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/MulticastDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/MulticastDefinition.java?rev=810861&r1=810860&r2=810861&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/MulticastDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/MulticastDefinition.java Thu Sep 3 10:15:03 2009
@@ -49,6 +49,8 @@
private String executorServiceRef;
@XmlAttribute(required = false)
private Boolean streaming;
+ @XmlAttribute(required = false)
+ private Boolean stopOnException;
@XmlTransient
private AggregationStrategy aggregationStrategy;
@@ -100,6 +102,19 @@
setStreaming(true);
return this;
}
+
+ /**
+ * Will now stop further processing if an exception occurred during processing of an
+ * {@link org.apache.camel.Exchange} and the caused exception will be thrown.
+ * <p/>
+ * The default behavior is to <b>not</b> stop but continue processing till the end
+ *
+ * @return the builder
+ */
+ public MulticastDefinition stopOnException() {
+ setStopOnException(true);
+ return this;
+ }
/**
* Setting the executor service for executing the multicasting action.
@@ -122,7 +137,8 @@
if (executorServiceRef != null) {
executorService = routeContext.lookup(executorServiceRef, ExecutorService.class);
}
- return new MulticastProcessor(list, aggregationStrategy, isParallelProcessing(), executorService, isStreaming());
+ return new MulticastProcessor(list, aggregationStrategy, isParallelProcessing(), executorService,
+ isStreaming(), isStopOnException());
}
public AggregationStrategy getAggregationStrategy() {
@@ -150,6 +166,14 @@
this.streaming = streaming;
}
+ public Boolean isStopOnException() {
+ return stopOnException != null ? stopOnException : false;
+ }
+
+ public void setStopOnException(Boolean stopOnException) {
+ this.stopOnException = stopOnException;
+ }
+
public ExecutorService getExecutorService() {
return executorService;
}
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/SplitDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SplitDefinition.java?rev=810861&r1=810860&r2=810861&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/SplitDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/SplitDefinition.java Thu Sep 3 10:15:03 2009
@@ -53,6 +53,8 @@
private String executorServiceRef;
@XmlAttribute(required = false)
private Boolean streaming = false;
+ @XmlAttribute(required = false)
+ private Boolean stopOnException;
public SplitDefinition() {
}
@@ -81,7 +83,7 @@
aggregationStrategy = createAggregationStrategy(routeContext);
executorService = createExecutorService(routeContext);
return new Splitter(getExpression().createExpression(routeContext), childProcessor, aggregationStrategy,
- isParallelProcessing(), executorService, streaming);
+ isParallelProcessing(), executorService, isStreaming(), isStopOnException());
}
@@ -145,8 +147,10 @@
* @param parallelProcessing <tt>true</tt> to use a thread pool, if <tt>false</tt> then work is done in the
* calling thread.
*
+ * @deprecated use #parallelProcessing instead
* @return the builder
*/
+ @Deprecated
public SplitDefinition parallelProcessing(boolean parallelProcessing) {
setParallelProcessing(parallelProcessing);
return this;
@@ -164,6 +168,19 @@
}
/**
+ * Will now stop further processing if an exception occurred during processing of an
+ * {@link org.apache.camel.Exchange} and the caused exception will be thrown.
+ * <p/>
+ * The default behavior is to <b>not</b> stop but continue processing till the end
+ *
+ * @return the builder
+ */
+ public SplitDefinition stopOnException() {
+ setStopOnException(true);
+ return this;
+ }
+
+ /**
* Setting the executor service for executing the splitting action.
*
* @param executorService the executor service
@@ -205,6 +222,14 @@
this.streaming = streaming;
}
+ public Boolean isStopOnException() {
+ return stopOnException != null ? stopOnException : false;
+ }
+
+ public void setStopOnException(Boolean stopOnException) {
+ this.stopOnException = stopOnException;
+ }
+
public ExecutorService getExecutorService() {
return executorService;
}
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java?rev=810861&r1=810860&r2=810861&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java Thu Sep 3 10:15:03 2009
@@ -26,7 +26,10 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.camel.CamelExchangeException;
import org.apache.camel.Exchange;
import org.apache.camel.Navigate;
import org.apache.camel.Processor;
@@ -54,8 +57,6 @@
private static final int DEFAULT_THREADPOOL_SIZE = 10;
private static final transient Log LOG = LogFactory.getLog(MulticastProcessor.class);
- // TODO: Add option to stop if an exception was thrown during processing to break asap (future task cancel)
-
/**
* Class that represent each step in the multicast route to do
*/
@@ -81,6 +82,7 @@
private final AggregationStrategy aggregationStrategy;
private final boolean isParallelProcessing;
private final boolean streaming;
+ private final boolean stopOnException;
private ExecutorService executorService;
public MulticastProcessor(Collection<Processor> processors) {
@@ -88,16 +90,18 @@
}
public MulticastProcessor(Collection<Processor> processors, AggregationStrategy aggregationStrategy) {
- this(processors, aggregationStrategy, false, null, false);
+ this(processors, aggregationStrategy, false, null, false, false);
}
- public MulticastProcessor(Collection<Processor> processors, AggregationStrategy aggregationStrategy, boolean parallelProcessing, ExecutorService executorService, boolean streaming) {
+ public MulticastProcessor(Collection<Processor> processors, AggregationStrategy aggregationStrategy,
+ boolean parallelProcessing, ExecutorService executorService, boolean streaming, boolean stopOnException) {
notNull(processors, "processors");
this.processors = processors;
this.aggregationStrategy = aggregationStrategy;
this.isParallelProcessing = parallelProcessing;
this.executorService = executorService;
this.streaming = streaming;
+ this.stopOnException = stopOnException;
if (isParallelProcessing()) {
if (this.executorService == null) {
@@ -123,7 +127,7 @@
if (isParallelProcessing()) {
doProcessParallel(result, pairs, isStreaming());
} else {
- doProcessSequntiel(result, pairs);
+ doProcessSequntial(result, pairs);
}
if (result.get() != null) {
@@ -132,7 +136,9 @@
}
protected void doProcessParallel(final AtomicExchange result, Iterable<ProcessorExchangePair> pairs, boolean streaming) throws InterruptedException, ExecutionException {
- CompletionService<Exchange> completion;
+ final CompletionService<Exchange> completion;
+ final AtomicBoolean running = new AtomicBoolean(true);
+
if (streaming) {
// execute tasks in paralle+streaming and aggregate in the order they are finished (out of order sequence)
completion = new ExecutorCompletionService<Exchange>(executorService);
@@ -140,20 +146,34 @@
// execute tasks in parallel and aggregate in the order the tasks are submitted (in order sequence)
completion = new SubmitOrderedCompletionService<Exchange>(executorService);
}
- int total = 0;
+
+ final AtomicInteger total = new AtomicInteger(0);
for (ProcessorExchangePair pair : pairs) {
final Processor producer = pair.getProcessor();
final Exchange subExchange = pair.getExchange();
- updateNewExchange(subExchange, total, pairs);
+ updateNewExchange(subExchange, total.intValue(), pairs);
completion.submit(new Callable<Exchange>() {
public Exchange call() throws Exception {
+ if (!running.get()) {
+ // do not start processing the task if we are not running
+ return subExchange;
+ }
+
try {
producer.process(subExchange);
} catch (Exception e) {
subExchange.setException(e);
}
+
+ // should we stop in case of an exception occurred during processing?
+ if (stopOnException && subExchange.getException() != null) {
+ // signal to stop running
+ running.set(false);
+ throw new CamelExchangeException("Parallel processing failed for number " + total.intValue(), subExchange, subExchange.getException());
+ }
+
if (LOG.isTraceEnabled()) {
LOG.trace("Parallel processing complete for exchange: " + subExchange);
}
@@ -161,10 +181,10 @@
}
});
- total++;
+ total.incrementAndGet();
}
- for (int i = 0; i < total; i++) {
+ for (int i = 0; i < total.intValue(); i++) {
Future<Exchange> future = completion.take();
Exchange subExchange = future.get();
if (aggregationStrategy != null) {
@@ -177,7 +197,7 @@
}
}
- protected void doProcessSequntiel(AtomicExchange result, Iterable<ProcessorExchangePair> pairs) throws Exception {
+ protected void doProcessSequntial(AtomicExchange result, Iterable<ProcessorExchangePair> pairs) throws Exception {
int total = 0;
for (ProcessorExchangePair pair : pairs) {
@@ -186,9 +206,19 @@
updateNewExchange(subExchange, total, pairs);
// process it sequentially
- producer.process(subExchange);
+ try {
+ producer.process(subExchange);
+ } catch (Exception e) {
+ subExchange.setException(e);
+ }
+
+ // should we stop in case of an exception occured during processing?
+ if (stopOnException && subExchange.getException() != null) {
+ throw new CamelExchangeException("Sequiental processing failed for number " + total, subExchange, subExchange.getException());
+ }
+
if (LOG.isTraceEnabled()) {
- LOG.trace("Sequientel processing complete for number " + total + " exchange: " + subExchange);
+ LOG.trace("Sequiental processing complete for number " + total + " exchange: " + subExchange);
}
if (aggregationStrategy != null) {
@@ -198,7 +228,7 @@
}
if (LOG.isDebugEnabled()) {
- LOG.debug("Done sequientel processing " + total + " exchanges");
+ LOG.debug("Done sequiental processing " + total + " exchanges");
}
}
@@ -265,6 +295,13 @@
}
/**
+ * Should the multicast processor stop processing further exchanges in case of an exception occurred?
+ */
+ public boolean isStopOnException() {
+ return stopOnException;
+ }
+
+ /**
* Returns the producers to multicast to
*/
public Collection<Processor> getProcessors() {
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java?rev=810861&r1=810860&r2=810861&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java Thu Sep 3 10:15:03 2009
@@ -45,12 +45,12 @@
private final Expression expression;
public Splitter(Expression expression, Processor destination, AggregationStrategy aggregationStrategy) {
- this(expression, destination, aggregationStrategy, false, null, false);
+ this(expression, destination, aggregationStrategy, false, null, false, false);
}
public Splitter(Expression expression, Processor destination, AggregationStrategy aggregationStrategy,
- boolean parallelProcessing, ExecutorService executorService, boolean streaming) {
- super(Collections.singleton(destination), aggregationStrategy, parallelProcessing, executorService, streaming);
+ boolean parallelProcessing, ExecutorService executorService, boolean streaming, boolean stopOnException) {
+ super(Collections.singleton(destination), aggregationStrategy, parallelProcessing, executorService, streaming, stopOnException);
this.expression = expression;
notNull(expression, "expression");
Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastNoStopOnExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastNoStopOnExceptionTest.java?rev=810861&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastNoStopOnExceptionTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastNoStopOnExceptionTest.java Thu Sep 3 10:15:03 2009
@@ -0,0 +1,88 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * @version $Revision$
+ */
+public class MulticastNoStopOnExceptionTest extends ContextTestSupport {
+
+ public void testMulticastNoStopOnExceptionOk() throws Exception {
+ getMockEndpoint("mock:foo").expectedBodiesReceived("Hello");
+ getMockEndpoint("mock:bar").expectedBodiesReceived("Hello");
+ getMockEndpoint("mock:baz").expectedBodiesReceived("Hello");
+ getMockEndpoint("mock:result").expectedBodiesReceived("Hello");
+
+ template.sendBody("direct:start", "Hello");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ public void testMulticastNoStopOnExceptionStop() throws Exception {
+ getMockEndpoint("mock:foo").expectedBodiesReceived("Kaboom");
+ getMockEndpoint("mock:bar").expectedMessageCount(0);
+ // we do not stop so we should continue and thus baz receives 1 message
+ getMockEndpoint("mock:baz").expectedMessageCount(1);
+ getMockEndpoint("mock:result").expectedMessageCount(0);
+
+ try {
+ template.sendBody("direct:start", "Kaboom");
+ fail("Should thrown an exception");
+ } catch (CamelExecutionException e) {
+ assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
+ assertEquals("Forced", e.getCause().getMessage());
+ }
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+ .multicast()
+ .to("direct:foo", "direct:bar", "direct:baz")
+ .end()
+ .to("mock:result");
+
+ from("direct:foo").to("mock:foo");
+
+ from("direct:bar").process(new MyProcessor()).to("mock:bar");
+
+ from("direct:baz").to("mock:baz");
+ }
+ };
+ }
+
+ public static class MyProcessor implements Processor {
+
+ public void process(Exchange exchange) throws Exception {
+ String body = exchange.getIn().getBody(String.class);
+ if ("Kaboom".equals(body)) {
+ throw new IllegalArgumentException("Forced");
+ }
+ }
+ }
+}
\ No newline at end of file
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastNoStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastNoStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastParallelNoStopOnExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastParallelNoStopOnExceptionTest.java?rev=810861&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastParallelNoStopOnExceptionTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastParallelNoStopOnExceptionTest.java Thu Sep 3 10:15:03 2009
@@ -0,0 +1,94 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * @version $Revision$
+ */
+public class MulticastParallelNoStopOnExceptionTest extends ContextTestSupport {
+
+ public void testMulticastParallelNoStopOnExceptionOk() throws Exception {
+ getMockEndpoint("mock:foo").expectedBodiesReceived("Hello");
+ getMockEndpoint("mock:bar").expectedBodiesReceived("Hello");
+ getMockEndpoint("mock:baz").expectedBodiesReceived("Hello");
+ getMockEndpoint("mock:result").expectedBodiesReceived("Hello");
+
+ template.sendBody("direct:start", "Hello");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ public void testMulticastParalllelNoStopOnExceptionStop() throws Exception {
+ getMockEndpoint("mock:foo").expectedBodiesReceived("Kaboom");
+ getMockEndpoint("mock:bar").expectedMessageCount(0);
+ // we do NOT stop so baz should also receive a message
+ getMockEndpoint("mock:baz").expectedMessageCount(1);
+ getMockEndpoint("mock:result").expectedMessageCount(0);
+
+ try {
+ template.sendBody("direct:start", "Kaboom");
+ fail("Should thrown an exception");
+ } catch (CamelExecutionException e) {
+ IllegalArgumentException cause = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
+ assertEquals("Forced", cause.getMessage());
+ }
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ // use a pool with 2 concurrent tasks so we cannot run to fast
+ ExecutorService service = Executors.newFixedThreadPool(2);
+
+ from("direct:start")
+ .multicast()
+ .parallelProcessing().executorService(service).to("direct:foo", "direct:bar", "direct:baz")
+ .end()
+ .to("mock:result");
+
+ // need a little delay to slow these okays down so we better can test stop when parallel
+ from("direct:foo").delay(1000).to("mock:foo");
+
+ from("direct:bar")
+ .process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ String body = exchange.getIn().getBody(String.class);
+ if ("Kaboom".equals(body)) {
+ throw new IllegalArgumentException("Forced");
+ }
+ }
+ }).to("mock:bar");
+
+ // need a little delay to slow these okays down so we better can test stop when parallel
+ from("direct:baz").delay(1000).to("mock:baz");
+ }
+ };
+ }
+}
\ No newline at end of file
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastParallelNoStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastParallelNoStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastParallelStopOnExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastParallelStopOnExceptionTest.java?rev=810861&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastParallelStopOnExceptionTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastParallelStopOnExceptionTest.java Thu Sep 3 10:15:03 2009
@@ -0,0 +1,99 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.apache.camel.CamelExchangeException;
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * @version $Revision$
+ */
+public class MulticastParallelStopOnExceptionTest extends ContextTestSupport {
+
+ public void testMulticastParallelStopOnExceptionOk() throws Exception {
+ getMockEndpoint("mock:foo").expectedBodiesReceived("Hello");
+ getMockEndpoint("mock:bar").expectedBodiesReceived("Hello");
+ getMockEndpoint("mock:baz").expectedBodiesReceived("Hello");
+ getMockEndpoint("mock:result").expectedBodiesReceived("Hello");
+
+ template.sendBody("direct:start", "Hello");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ public void testMulticastParalllelStopOnExceptionStop() throws Exception {
+ getMockEndpoint("mock:foo").expectedBodiesReceived("Kaboom");
+ getMockEndpoint("mock:bar").expectedMessageCount(0);
+ // we do stop so we should NOT continue and thus baz do not receive any message
+ getMockEndpoint("mock:baz").expectedMessageCount(0);
+ getMockEndpoint("mock:result").expectedMessageCount(0);
+
+ try {
+ template.sendBody("direct:start", "Kaboom");
+ fail("Should thrown an exception");
+ } catch (CamelExecutionException e) {
+ ExecutionException ee = assertIsInstanceOf(ExecutionException.class, e.getCause());
+ CamelExchangeException cause = assertIsInstanceOf(CamelExchangeException.class, ee.getCause());
+ assertTrue(cause.getMessage().startsWith("Parallel processing failed for number "));
+ assertTrue(cause.getMessage().endsWith("on the exchange: Exchange[Message: Kaboom]"));
+ assertEquals("Forced", cause.getCause().getMessage());
+ }
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ // use a pool with 2 concurrent tasks so we cannot run to fast
+ ExecutorService service = Executors.newFixedThreadPool(2);
+
+ from("direct:start")
+ .multicast()
+ .parallelProcessing().stopOnException().executorService(service).to("direct:foo", "direct:bar", "direct:baz")
+ .end()
+ .to("mock:result");
+
+ // need a little delay to slow these okays down so we better can test stop when parallel
+ from("direct:foo").delay(1000).to("mock:foo");
+
+ from("direct:bar")
+ .process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ String body = exchange.getIn().getBody(String.class);
+ if ("Kaboom".equals(body)) {
+ throw new IllegalArgumentException("Forced");
+ }
+ }
+ }).to("mock:bar");
+
+ // need a little delay to slow these okays down so we better can test stop when parallel
+ from("direct:baz").delay(1000).to("mock:baz");
+ }
+ };
+ }
+}
\ No newline at end of file
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastParallelStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastParallelStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastStopOnExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastStopOnExceptionTest.java?rev=810861&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastStopOnExceptionTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastStopOnExceptionTest.java Thu Sep 3 10:15:03 2009
@@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import org.apache.camel.CamelExchangeException;
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * @version $Revision$
+ */
+public class MulticastStopOnExceptionTest extends ContextTestSupport {
+
+ public void testMulticastStopOnExceptionOk() throws Exception {
+ getMockEndpoint("mock:foo").expectedBodiesReceived("Hello");
+ getMockEndpoint("mock:bar").expectedBodiesReceived("Hello");
+ getMockEndpoint("mock:baz").expectedBodiesReceived("Hello");
+ getMockEndpoint("mock:result").expectedBodiesReceived("Hello");
+
+ template.sendBody("direct:start", "Hello");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ public void testMulticastStopOnExceptionStop() throws Exception {
+ getMockEndpoint("mock:foo").expectedBodiesReceived("Kaboom");
+ getMockEndpoint("mock:bar").expectedMessageCount(0);
+ // we do stop so we should NOT continue and thus baz do not receive any message
+ getMockEndpoint("mock:baz").expectedMessageCount(0);
+ getMockEndpoint("mock:result").expectedMessageCount(0);
+
+ try {
+ template.sendBody("direct:start", "Kaboom");
+ fail("Should thrown an exception");
+ } catch (CamelExecutionException e) {
+ CamelExchangeException cause = assertIsInstanceOf(CamelExchangeException.class, e.getCause());
+ assertEquals("Sequiental processing failed for number 1 on the exchange: Exchange[Message: Kaboom]", cause.getMessage());
+ assertEquals("Forced", cause.getCause().getMessage());
+ }
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+ .multicast()
+ .stopOnException().to("direct:foo", "direct:bar", "direct:baz")
+ .end()
+ .to("mock:result");
+
+ from("direct:foo").to("mock:foo");
+
+ from("direct:bar").process(new MyProcessor()).to("mock:bar");
+
+ from("direct:baz").to("mock:baz");
+ }
+ };
+ }
+
+ public static class MyProcessor implements Processor {
+
+ public void process(Exchange exchange) throws Exception {
+ String body = exchange.getIn().getBody(String.class);
+ if ("Kaboom".equals(body)) {
+ throw new IllegalArgumentException("Forced");
+ }
+ }
+ }
+}
\ No newline at end of file
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterNoStopOnExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterNoStopOnExceptionTest.java?rev=810861&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterNoStopOnExceptionTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterNoStopOnExceptionTest.java Thu Sep 3 10:15:03 2009
@@ -0,0 +1,79 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version $Revision$
+ */
+public class SplitterNoStopOnExceptionTest extends ContextTestSupport {
+
+ public void testSplitNoStopOnExceptionOk() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:split");
+ mock.expectedBodiesReceived("Hello World", "Bye World");
+
+ template.sendBody("direct:start", "Hello World,Bye World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ public void testSplitNoStopOnExceptionStop() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:split");
+ // we do not stop so we split to completion and thus we receive 2 messages
+ mock.expectedBodiesReceived("Hello World", "Bye World");
+
+ try {
+ template.sendBody("direct:start", "Hello World,Kaboom,Bye World");
+ fail("Should thrown an exception");
+ } catch (CamelExecutionException e) {
+ assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
+ assertEquals("Forced", e.getCause().getMessage());
+ }
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+ .split(body().tokenize(","))
+ .process(new MyProcessor())
+ .to("mock:split");
+ }
+ };
+ }
+
+ public static class MyProcessor implements Processor {
+
+ public void process(Exchange exchange) throws Exception {
+ String body = exchange.getIn().getBody(String.class);
+ if ("Kaboom".equals(body)) {
+ throw new IllegalArgumentException("Forced");
+ }
+ }
+ }
+
+}
\ No newline at end of file
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterNoStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterNoStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterParallelNoStopOnExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterParallelNoStopOnExceptionTest.java?rev=810861&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterParallelNoStopOnExceptionTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterParallelNoStopOnExceptionTest.java Thu Sep 3 10:15:03 2009
@@ -0,0 +1,84 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version $Revision$
+ */
+public class SplitterParallelNoStopOnExceptionTest extends ContextTestSupport {
+
+ public void testSplitParallelNoStopOnExceptionOk() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:split");
+ mock.expectedBodiesReceivedInAnyOrder("Hello World", "Bye World");
+
+ template.sendBody("direct:start", "Hello World,Bye World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ public void testSplitParallelNoStopOnExceptionStop() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:split");
+ // we do NOT stop so we receive all messages except the one that goes kaboom
+ mock.allMessages().body().isNotEqualTo("Kaboom");
+ mock.expectedBodiesReceivedInAnyOrder("Hello World", "Goodday World", "Bye World");
+
+ try {
+ template.sendBody("direct:start", "Hello World,Goodday World,Kaboom,Bye World");
+ fail("Should thrown an exception");
+ } catch (CamelExecutionException e) {
+ IllegalArgumentException cause = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
+ assertEquals("Forced", cause.getMessage());
+ }
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ // use a pool with 2 concurrent tasks so we cannot run to fast
+ ExecutorService service = Executors.newFixedThreadPool(2);
+
+ from("direct:start")
+ .split(body().tokenize(",")).parallelProcessing().executorService(service)
+ .process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ String body = exchange.getIn().getBody(String.class);
+ if ("Kaboom".equals(body)) {
+ throw new IllegalArgumentException("Forced");
+ }
+ // need to let ok body sleep so when we fail we do not have all tasks running
+ Thread.sleep(1000);
+ }
+ }).to("mock:split");
+ }
+ };
+ }
+
+}
\ No newline at end of file
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterParallelNoStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterParallelNoStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterParallelStopOnExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterParallelStopOnExceptionTest.java?rev=810861&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterParallelStopOnExceptionTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterParallelStopOnExceptionTest.java Thu Sep 3 10:15:03 2009
@@ -0,0 +1,88 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.apache.camel.CamelExchangeException;
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version $Revision$
+ */
+public class SplitterParallelStopOnExceptionTest extends ContextTestSupport {
+
+ public void testSplitParallelStopOnExceptionOk() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:split");
+ mock.expectedBodiesReceivedInAnyOrder("Hello World", "Bye World");
+
+ template.sendBody("direct:start", "Hello World,Bye World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ public void testSplitParallelStopOnExceptionStop() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:split");
+ mock.allMessages().body().isNotEqualTo("Kaboom");
+ mock.allMessages().body().isNotEqualTo("Bye World");
+
+ try {
+ template.sendBody("direct:start", "Hello World,Goodday World,Kaboom,Bye World");
+ fail("Should thrown an exception");
+ } catch (CamelExecutionException e) {
+ ExecutionException ee = assertIsInstanceOf(ExecutionException.class, e.getCause());
+ CamelExchangeException cause = assertIsInstanceOf(CamelExchangeException.class, ee.getCause());
+ assertTrue(cause.getMessage().startsWith("Parallel processing failed for number "));
+ assertTrue(cause.getMessage().endsWith("on the exchange: Exchange[Message: Kaboom]"));
+ assertEquals("Forced", cause.getCause().getMessage());
+ }
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ // use a pool with 2 concurrent tasks so we cannot run to fast
+ ExecutorService service = Executors.newFixedThreadPool(2);
+
+ from("direct:start")
+ .split(body().tokenize(",")).parallelProcessing().stopOnException().executorService(service)
+ .process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ String body = exchange.getIn().getBody(String.class);
+ if ("Kaboom".equals(body)) {
+ throw new IllegalArgumentException("Forced");
+ }
+ // need to let ok body sleep so when we fail we do not have all tasks running
+ Thread.sleep(1000);
+ }
+ }).to("mock:split");
+ }
+ };
+ }
+
+}
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterParallelStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterParallelStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterStopOnExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterStopOnExceptionTest.java?rev=810861&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterStopOnExceptionTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterStopOnExceptionTest.java Thu Sep 3 10:15:03 2009
@@ -0,0 +1,80 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import org.apache.camel.CamelExchangeException;
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version $Revision$
+ */
+public class SplitterStopOnExceptionTest extends ContextTestSupport {
+
+ public void testSplitStopOnExceptionOk() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:split");
+ mock.expectedBodiesReceived("Hello World", "Bye World");
+
+ template.sendBody("direct:start", "Hello World,Bye World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ public void testSplitStopOnExceptionStop() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:split");
+ // we do stop so we stop splitting when the exception occurs and thus we only receive 1 message
+ mock.expectedBodiesReceived("Hello World");
+
+ try {
+ template.sendBody("direct:start", "Hello World,Kaboom,Bye World");
+ fail("Should thrown an exception");
+ } catch (CamelExecutionException e) {
+ CamelExchangeException cause = assertIsInstanceOf(CamelExchangeException.class, e.getCause());
+ assertEquals("Sequiental processing failed for number 1 on the exchange: Exchange[Message: Kaboom]", cause.getMessage());
+ assertEquals("Forced", cause.getCause().getMessage());
+ }
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+ .split(body().tokenize(",")).stopOnException()
+ .process(new MyProcessor())
+ .to("mock:split");
+ }
+ };
+ }
+
+ public static class MyProcessor implements Processor {
+
+ public void process(Exchange exchange) throws Exception {
+ String body = exchange.getIn().getBody(String.class);
+ if ("Kaboom".equals(body)) {
+ throw new IllegalArgumentException("Forced");
+ }
+ }
+ }
+}
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastNoStopOnExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastNoStopOnExceptionTest.java?rev=810861&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastNoStopOnExceptionTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastNoStopOnExceptionTest.java Thu Sep 3 10:15:03 2009
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.MulticastNoStopOnExceptionTest;
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+/**
+ * @version $Revision$
+ */
+public class SpringMulticastNoStopOnExceptionTest extends MulticastNoStopOnExceptionTest {
+
+ protected CamelContext createCamelContext() throws Exception {
+ return createSpringCamelContext(this, "org/apache/camel/spring/processor/SpringMulticastNoStopOnExceptionTest.xml");
+ }
+
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastNoStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastNoStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastStopOnExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastStopOnExceptionTest.java?rev=810861&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastStopOnExceptionTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastStopOnExceptionTest.java Thu Sep 3 10:15:03 2009
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.MulticastStopOnExceptionTest;
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+/**
+ * @version $Revision$
+ */
+public class SpringMulticastStopOnExceptionTest extends MulticastStopOnExceptionTest {
+
+ protected CamelContext createCamelContext() throws Exception {
+ return createSpringCamelContext(this, "org/apache/camel/spring/processor/SpringMulticastStopOnExceptionTest.xml");
+ }
+
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitterNoStopOnExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitterNoStopOnExceptionTest.java?rev=810861&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitterNoStopOnExceptionTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitterNoStopOnExceptionTest.java Thu Sep 3 10:15:03 2009
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.SplitterNoStopOnExceptionTest;
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+/**
+ * @version $Revision$
+ */
+public class SpringSplitterNoStopOnExceptionTest extends SplitterNoStopOnExceptionTest {
+
+ protected CamelContext createCamelContext() throws Exception {
+ return createSpringCamelContext(this, "org/apache/camel/spring/processor/SpringSplitterNoStopOnExceptionTest.xml");
+ }
+
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitterNoStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitterNoStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitterStopOnExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitterStopOnExceptionTest.java?rev=810861&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitterStopOnExceptionTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitterStopOnExceptionTest.java Thu Sep 3 10:15:03 2009
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.SplitterStopOnExceptionTest;
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+/**
+ * @version $Revision$
+ */
+public class SpringSplitterStopOnExceptionTest extends SplitterStopOnExceptionTest {
+
+ protected CamelContext createCamelContext() throws Exception {
+ return createSpringCamelContext(this, "org/apache/camel/spring/processor/SpringSplitterStopOnExceptionTest.xml");
+ }
+
+}
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitterStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitterStopOnExceptionTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastNoStopOnExceptionTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastNoStopOnExceptionTest.xml?rev=810861&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastNoStopOnExceptionTest.xml (added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastNoStopOnExceptionTest.xml Thu Sep 3 10:15:03 2009
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <bean id="myProcessor" class="org.apache.camel.processor.MulticastNoStopOnExceptionTest$MyProcessor"/>
+
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <multicast stopOnException="false">
+ <to uri="direct:foo"/>
+ <to uri="direct:bar"/>
+ <to uri="direct:baz"/>
+ </multicast>
+ <to uri="mock:result"/>
+ </route>
+
+ <route>
+ <from uri="direct:foo"/>
+ <to uri="mock:foo"/>
+ </route>
+
+ <route>
+ <from uri="direct:bar"/>
+ <process ref="myProcessor"/>
+ <to uri="mock:bar"/>
+ </route>
+
+ <route>
+ <from uri="direct:baz"/>
+ <to uri="mock:baz"/>
+ </route>
+
+ </camelContext>
+
+</beans>
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastNoStopOnExceptionTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastNoStopOnExceptionTest.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastNoStopOnExceptionTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastStopOnExceptionTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastStopOnExceptionTest.xml?rev=810861&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastStopOnExceptionTest.xml (added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastStopOnExceptionTest.xml Thu Sep 3 10:15:03 2009
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <bean id="myProcessor" class="org.apache.camel.processor.MulticastStopOnExceptionTest$MyProcessor"/>
+
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <multicast stopOnException="true">
+ <to uri="direct:foo"/>
+ <to uri="direct:bar"/>
+ <to uri="direct:baz"/>
+ </multicast>
+ <to uri="mock:result"/>
+ </route>
+
+ <route>
+ <from uri="direct:foo"/>
+ <to uri="mock:foo"/>
+ </route>
+
+ <route>
+ <from uri="direct:bar"/>
+ <process ref="myProcessor"/>
+ <to uri="mock:bar"/>
+ </route>
+
+ <route>
+ <from uri="direct:baz"/>
+ <to uri="mock:baz"/>
+ </route>
+
+ </camelContext>
+
+</beans>
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastStopOnExceptionTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastStopOnExceptionTest.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastStopOnExceptionTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterNoStopOnExceptionTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterNoStopOnExceptionTest.xml?rev=810861&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterNoStopOnExceptionTest.xml (added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterNoStopOnExceptionTest.xml Thu Sep 3 10:15:03 2009
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <bean id="myProcessor" class="org.apache.camel.processor.SplitterNoStopOnExceptionTest$MyProcessor"/>
+
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <split stopOnException="false">
+ <tokenize token=","/>
+ <process ref="myProcessor"/>
+ <to uri="mock:split"/>
+ </split>
+ </route>
+ </camelContext>
+
+</beans>
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterNoStopOnExceptionTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterNoStopOnExceptionTest.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterNoStopOnExceptionTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Copied: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterStopOnExceptionTest.xml (from r810777, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/choice.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterStopOnExceptionTest.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterStopOnExceptionTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/choice.xml&r1=810777&r2=810861&rev=810861&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/choice.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitterStopOnExceptionTest.xml Thu Sep 3 10:15:03 2009
@@ -22,26 +22,17 @@
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">
- <!-- START SNIPPET: example -->
- <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
- <route>
- <from uri="direct:start"/>
- <choice>
- <when>
- <xpath>$foo = 'bar'</xpath>
- <to uri="mock:x"/>
- </when>
- <when>
- <xpath>$foo = 'cheese'</xpath>
- <to uri="mock:y"/>
- </when>
- <otherwise>
- <to uri="mock:z"/>
- </otherwise>
- </choice>
- <to uri="mock:end"/>
- </route>
- </camelContext>
- <!-- END SNIPPET: example -->
+ <bean id="myProcessor" class="org.apache.camel.processor.SplitterStopOnExceptionTest$MyProcessor"/>
+
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <split stopOnException="true">
+ <tokenize token=","/>
+ <process ref="myProcessor"/>
+ <to uri="mock:split"/>
+ </split>
+ </route>
+ </camelContext>
</beans>