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 2013/09/24 11:44:04 UTC
[1/4] git commit: CAMEL-6780: Binding component - Avoid duplicate
prepare.
Updated Branches:
refs/heads/camel-2.11.x 4aed32f69 -> ce710545a
refs/heads/camel-2.12.x 0018d8992 -> 936a589a6
refs/heads/master 1ce21f422 -> 1e5feb83f
CAMEL-6780: Binding component - Avoid duplicate prepare.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/62994fd8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/62994fd8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/62994fd8
Branch: refs/heads/master
Commit: 62994fd811c0b95b7594f832787b8e537b169c25
Parents: 1ce21f4
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Sep 24 11:41:23 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Sep 24 11:41:23 2013 +0200
----------------------------------------------------------------------
.../component/binding/BindingEndpoint.java | 23 ++++----------------
.../org/apache/camel/processor/Pipeline.java | 10 +--------
.../apache/camel/processor/PipelineHelper.java | 20 +++++++++++++++++
3 files changed, 25 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/62994fd8/camel-core/src/main/java/org/apache/camel/component/binding/BindingEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/binding/BindingEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/binding/BindingEndpoint.java
index 1c44fb3..65707c1 100644
--- a/camel-core/src/main/java/org/apache/camel/component/binding/BindingEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/binding/BindingEndpoint.java
@@ -24,9 +24,9 @@ import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.processor.PipelineHelper;
import org.apache.camel.spi.Binding;
import org.apache.camel.spi.HasBinding;
-import org.apache.camel.util.ExchangeHelper;
import org.apache.camel.util.ServiceHelper;
/**
@@ -73,25 +73,10 @@ public class BindingEndpoint extends DefaultEndpoint implements HasBinding {
* Applies the {@link Binding} processor to the given exchange before passing it on to the delegateProcessor (either a producer or consumer)
*/
public void pipelineBindingProcessor(Processor bindingProcessor, Exchange exchange, Processor delegateProcessor) throws Exception {
- // use same exchange - seems Pipeline does these days
- Exchange bindingExchange = exchange;
- bindingProcessor.process(bindingExchange);
- Exchange delegateExchange = createNextExchange(bindingExchange);
- ExchangeHelper.copyResults(bindingExchange, delegateExchange);
- delegateProcessor.process(delegateExchange);
- }
-
- // TODO this code was copied from Pipeline - should make it static and reuse the code?
- protected Exchange createNextExchange(Exchange previousExchange) {
- Exchange answer = previousExchange;
+ bindingProcessor.process(exchange);
- // now lets set the input of the next exchange to the output of the
- // previous message if it is not null
- if (answer.hasOut()) {
- answer.setIn(answer.getOut());
- answer.setOut(null);
- }
- return answer;
+ Exchange delegateExchange = PipelineHelper.createNextExchange(exchange);
+ delegateProcessor.process(delegateExchange);
}
@Override
http://git-wip-us.apache.org/repos/asf/camel/blob/62994fd8/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java b/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
index 99ab66e..9c14476 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
@@ -158,15 +158,7 @@ public class Pipeline extends MulticastProcessor implements AsyncProcessor, Trac
* @return a new exchange
*/
protected Exchange createNextExchange(Exchange previousExchange) {
- Exchange answer = previousExchange;
-
- // now lets set the input of the next exchange to the output of the
- // previous message if it is not null
- if (answer.hasOut()) {
- answer.setIn(answer.getOut());
- answer.setOut(null);
- }
- return answer;
+ return PipelineHelper.createNextExchange(previousExchange);
}
protected boolean continueRouting(Iterator<Processor> it, Exchange exchange) {
http://git-wip-us.apache.org/repos/asf/camel/blob/62994fd8/camel-core/src/main/java/org/apache/camel/processor/PipelineHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/PipelineHelper.java b/camel-core/src/main/java/org/apache/camel/processor/PipelineHelper.java
index 8c850a3..ebc5398 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/PipelineHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/PipelineHelper.java
@@ -92,4 +92,24 @@ public final class PipelineHelper {
return true;
}
+ /**
+ * Strategy method to create the next exchange from the previous exchange.
+ * <p/>
+ * Remember to copy the original exchange id otherwise correlation of ids in the log is a problem
+ *
+ * @param previousExchange the previous exchange
+ * @return a new exchange
+ */
+ public static Exchange createNextExchange(Exchange previousExchange) {
+ Exchange answer = previousExchange;
+
+ // now lets set the input of the next exchange to the output of the
+ // previous message if it is not null
+ if (answer.hasOut()) {
+ answer.setIn(answer.getOut());
+ answer.setOut(null);
+ }
+ return answer;
+ }
+
}
[2/4] git commit: Fixed CS
Posted by da...@apache.org.
Fixed CS
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1e5feb83
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1e5feb83
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1e5feb83
Branch: refs/heads/master
Commit: 1e5feb83f1437d815b5192475bb898b14e8a2d6f
Parents: 62994fd
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Sep 24 11:42:27 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Sep 24 11:42:27 2013 +0200
----------------------------------------------------------------------
.../apache/camel/processor/aggregator/AggregatorLockingTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/1e5feb83/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorLockingTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorLockingTest.java b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorLockingTest.java
index 2bb64b2..3926c7c 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorLockingTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorLockingTest.java
@@ -32,7 +32,7 @@ public class AggregatorLockingTest extends ContextTestSupport {
public void testAggregationWithoutParallelNorOptimisticShouldNotLockDownstreamProcessors() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedBodiesReceivedInAnyOrder("a","b");
+ mock.expectedBodiesReceivedInAnyOrder("a", "b");
template.sendBodyAndHeader("seda:a", "a", "myId", 1);
template.sendBodyAndHeader("seda:a", "b", "myId", 2);
@@ -60,7 +60,7 @@ public class AggregatorLockingTest extends ContextTestSupport {
public void process(Exchange exchange) throws Exception {
latch.countDown();
// block until the other thread counts down as well
- if(!latch.await(5, TimeUnit.SECONDS)) {
+ if (!latch.await(5, TimeUnit.SECONDS)) {
throw new RuntimeException("Took too long; assume threads are blocked and fail test");
}
}
[3/4] git commit: CAMEL-6780: Binding component - Avoid duplicate
prepare.
Posted by da...@apache.org.
CAMEL-6780: Binding component - Avoid duplicate prepare.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/936a589a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/936a589a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/936a589a
Branch: refs/heads/camel-2.12.x
Commit: 936a589a6ae7e2adfb03a562cd7ec1836159305b
Parents: 0018d89
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Sep 24 11:41:23 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Sep 24 11:43:13 2013 +0200
----------------------------------------------------------------------
.../component/binding/BindingEndpoint.java | 23 ++++----------------
.../org/apache/camel/processor/Pipeline.java | 10 +--------
.../apache/camel/processor/PipelineHelper.java | 20 +++++++++++++++++
3 files changed, 25 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/936a589a/camel-core/src/main/java/org/apache/camel/component/binding/BindingEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/binding/BindingEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/binding/BindingEndpoint.java
index 1c44fb3..65707c1 100644
--- a/camel-core/src/main/java/org/apache/camel/component/binding/BindingEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/binding/BindingEndpoint.java
@@ -24,9 +24,9 @@ import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.processor.PipelineHelper;
import org.apache.camel.spi.Binding;
import org.apache.camel.spi.HasBinding;
-import org.apache.camel.util.ExchangeHelper;
import org.apache.camel.util.ServiceHelper;
/**
@@ -73,25 +73,10 @@ public class BindingEndpoint extends DefaultEndpoint implements HasBinding {
* Applies the {@link Binding} processor to the given exchange before passing it on to the delegateProcessor (either a producer or consumer)
*/
public void pipelineBindingProcessor(Processor bindingProcessor, Exchange exchange, Processor delegateProcessor) throws Exception {
- // use same exchange - seems Pipeline does these days
- Exchange bindingExchange = exchange;
- bindingProcessor.process(bindingExchange);
- Exchange delegateExchange = createNextExchange(bindingExchange);
- ExchangeHelper.copyResults(bindingExchange, delegateExchange);
- delegateProcessor.process(delegateExchange);
- }
-
- // TODO this code was copied from Pipeline - should make it static and reuse the code?
- protected Exchange createNextExchange(Exchange previousExchange) {
- Exchange answer = previousExchange;
+ bindingProcessor.process(exchange);
- // now lets set the input of the next exchange to the output of the
- // previous message if it is not null
- if (answer.hasOut()) {
- answer.setIn(answer.getOut());
- answer.setOut(null);
- }
- return answer;
+ Exchange delegateExchange = PipelineHelper.createNextExchange(exchange);
+ delegateProcessor.process(delegateExchange);
}
@Override
http://git-wip-us.apache.org/repos/asf/camel/blob/936a589a/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java b/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
index 99ab66e..9c14476 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
@@ -158,15 +158,7 @@ public class Pipeline extends MulticastProcessor implements AsyncProcessor, Trac
* @return a new exchange
*/
protected Exchange createNextExchange(Exchange previousExchange) {
- Exchange answer = previousExchange;
-
- // now lets set the input of the next exchange to the output of the
- // previous message if it is not null
- if (answer.hasOut()) {
- answer.setIn(answer.getOut());
- answer.setOut(null);
- }
- return answer;
+ return PipelineHelper.createNextExchange(previousExchange);
}
protected boolean continueRouting(Iterator<Processor> it, Exchange exchange) {
http://git-wip-us.apache.org/repos/asf/camel/blob/936a589a/camel-core/src/main/java/org/apache/camel/processor/PipelineHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/PipelineHelper.java b/camel-core/src/main/java/org/apache/camel/processor/PipelineHelper.java
index 8c850a3..ebc5398 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/PipelineHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/PipelineHelper.java
@@ -92,4 +92,24 @@ public final class PipelineHelper {
return true;
}
+ /**
+ * Strategy method to create the next exchange from the previous exchange.
+ * <p/>
+ * Remember to copy the original exchange id otherwise correlation of ids in the log is a problem
+ *
+ * @param previousExchange the previous exchange
+ * @return a new exchange
+ */
+ public static Exchange createNextExchange(Exchange previousExchange) {
+ Exchange answer = previousExchange;
+
+ // now lets set the input of the next exchange to the output of the
+ // previous message if it is not null
+ if (answer.hasOut()) {
+ answer.setIn(answer.getOut());
+ answer.setOut(null);
+ }
+ return answer;
+ }
+
}
[4/4] git commit: CAMEL-6780: Binding component - Avoid duplicate
prepare.
Posted by da...@apache.org.
CAMEL-6780: Binding component - Avoid duplicate prepare.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ce710545
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ce710545
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ce710545
Branch: refs/heads/camel-2.11.x
Commit: ce710545affe8f49e2c8a39b7d157a801ce003b8
Parents: 4aed32f
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Sep 24 11:41:23 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Sep 24 11:43:28 2013 +0200
----------------------------------------------------------------------
.../component/binding/BindingEndpoint.java | 23 ++++----------------
.../org/apache/camel/processor/Pipeline.java | 10 +--------
.../apache/camel/processor/PipelineHelper.java | 20 +++++++++++++++++
3 files changed, 25 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ce710545/camel-core/src/main/java/org/apache/camel/component/binding/BindingEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/binding/BindingEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/binding/BindingEndpoint.java
index 1c44fb3..65707c1 100644
--- a/camel-core/src/main/java/org/apache/camel/component/binding/BindingEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/binding/BindingEndpoint.java
@@ -24,9 +24,9 @@ import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.processor.PipelineHelper;
import org.apache.camel.spi.Binding;
import org.apache.camel.spi.HasBinding;
-import org.apache.camel.util.ExchangeHelper;
import org.apache.camel.util.ServiceHelper;
/**
@@ -73,25 +73,10 @@ public class BindingEndpoint extends DefaultEndpoint implements HasBinding {
* Applies the {@link Binding} processor to the given exchange before passing it on to the delegateProcessor (either a producer or consumer)
*/
public void pipelineBindingProcessor(Processor bindingProcessor, Exchange exchange, Processor delegateProcessor) throws Exception {
- // use same exchange - seems Pipeline does these days
- Exchange bindingExchange = exchange;
- bindingProcessor.process(bindingExchange);
- Exchange delegateExchange = createNextExchange(bindingExchange);
- ExchangeHelper.copyResults(bindingExchange, delegateExchange);
- delegateProcessor.process(delegateExchange);
- }
-
- // TODO this code was copied from Pipeline - should make it static and reuse the code?
- protected Exchange createNextExchange(Exchange previousExchange) {
- Exchange answer = previousExchange;
+ bindingProcessor.process(exchange);
- // now lets set the input of the next exchange to the output of the
- // previous message if it is not null
- if (answer.hasOut()) {
- answer.setIn(answer.getOut());
- answer.setOut(null);
- }
- return answer;
+ Exchange delegateExchange = PipelineHelper.createNextExchange(exchange);
+ delegateProcessor.process(delegateExchange);
}
@Override
http://git-wip-us.apache.org/repos/asf/camel/blob/ce710545/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java b/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
index 3ace4c5..28779d8 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
@@ -157,15 +157,7 @@ public class Pipeline extends MulticastProcessor implements AsyncProcessor, Trac
* @return a new exchange
*/
protected Exchange createNextExchange(Exchange previousExchange) {
- Exchange answer = previousExchange;
-
- // now lets set the input of the next exchange to the output of the
- // previous message if it is not null
- if (answer.hasOut()) {
- answer.setIn(answer.getOut());
- answer.setOut(null);
- }
- return answer;
+ return PipelineHelper.createNextExchange(previousExchange);
}
protected boolean continueRouting(Iterator<Processor> it, Exchange exchange) {
http://git-wip-us.apache.org/repos/asf/camel/blob/ce710545/camel-core/src/main/java/org/apache/camel/processor/PipelineHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/PipelineHelper.java b/camel-core/src/main/java/org/apache/camel/processor/PipelineHelper.java
index 8c850a3..ebc5398 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/PipelineHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/PipelineHelper.java
@@ -92,4 +92,24 @@ public final class PipelineHelper {
return true;
}
+ /**
+ * Strategy method to create the next exchange from the previous exchange.
+ * <p/>
+ * Remember to copy the original exchange id otherwise correlation of ids in the log is a problem
+ *
+ * @param previousExchange the previous exchange
+ * @return a new exchange
+ */
+ public static Exchange createNextExchange(Exchange previousExchange) {
+ Exchange answer = previousExchange;
+
+ // now lets set the input of the next exchange to the output of the
+ // previous message if it is not null
+ if (answer.hasOut()) {
+ answer.setIn(answer.getOut());
+ answer.setOut(null);
+ }
+ return answer;
+ }
+
}