Repository: camel Updated Branches: refs/heads/master 9b9e17d80 -> f4a81c8f4
CAMEL-6665 added support for disabling recipientList delimiter parsing Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f4a81c8f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f4a81c8f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f4a81c8f Branch: refs/heads/master Commit: f4a81c8f4ef48ff29438321520ff44d6f57102b5 Parents: 9b9e17d Author: boday <bo...@apache.org> Authored: Mon Mar 10 05:07:18 2014 -0700 Committer: boday <bo...@apache.org> Committed: Mon Mar 10 05:10:30 2014 -0700 ---------------------------------------------------------------------- .../org/apache/camel/processor/RecipientList.java | 10 +++++++++- .../processor/RecipientListWithDelimiterTest.java | 17 +++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/f4a81c8f/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java b/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java index 4b700a9..b1b85ed 100644 --- a/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java +++ b/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java @@ -16,6 +16,7 @@ */ package org.apache.camel.processor; +import java.util.Collections; import java.util.Iterator; import java.util.concurrent.ExecutorService; @@ -46,6 +47,7 @@ import static org.apache.camel.util.ObjectHelper.notNull; * @version */ public class RecipientList extends ServiceSupport implements AsyncProcessor { + private static final String IGNORE_DELIMITER_MARKER = "false"; private final CamelContext camelContext; private ProducerCache producerCache; private Expression expression; @@ -116,7 +118,13 @@ public class RecipientList extends ServiceSupport implements AsyncProcessor { * Sends the given exchange to the recipient list */ public boolean sendToRecipientList(Exchange exchange, Object recipientList, AsyncCallback callback) { - Iterator<Object> iter = ObjectHelper.createIterator(recipientList, delimiter); + Iterator<Object> iter; + + if (delimiter != null && delimiter.equalsIgnoreCase(IGNORE_DELIMITER_MARKER)) { + iter = ObjectHelper.createIterator(recipientList, null); + } else { + iter = ObjectHelper.createIterator(recipientList, delimiter); + } RecipientListProcessor rlp = new RecipientListProcessor(exchange.getContext(), producerCache, iter, getAggregationStrategy(), isParallelProcessing(), getExecutorService(), isShutdownExecutorService(), http://git-wip-us.apache.org/repos/asf/camel/blob/f4a81c8f/camel-core/src/test/java/org/apache/camel/processor/RecipientListWithDelimiterTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/processor/RecipientListWithDelimiterTest.java b/camel-core/src/test/java/org/apache/camel/processor/RecipientListWithDelimiterTest.java index 5b5a527..77c5952 100644 --- a/camel-core/src/test/java/org/apache/camel/processor/RecipientListWithDelimiterTest.java +++ b/camel-core/src/test/java/org/apache/camel/processor/RecipientListWithDelimiterTest.java @@ -52,6 +52,23 @@ public class RecipientListWithDelimiterTest extends ContextTestSupport { assertMockEndpointsSatisfied(); } + public void testRecipientListWithDelimiterDisabled() throws Exception { + context.addRoutes(new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:a").recipientList(header("myHeader"), "false"); + } + }); + context.start(); + + MockEndpoint xyz = getMockEndpoint("mock:falseDelimiterTest"); + xyz.expectedBodiesReceived("answer"); + + template.sendBodyAndHeader("direct:a", "answer", "myHeader", "mock:falseDelimiterTest"); + + assertMockEndpointsSatisfied(); + } + public void testRecipientListWithTokenizer() throws Exception { context.addRoutes(new RouteBuilder() { @Override