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 2023/02/17 18:42:43 UTC
[camel] branch camel-3.18.x updated (d3235555278 -> 3728b43c7e7)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch camel-3.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git
from d3235555278 CAMEL-19068: remove SAGA_LONG_RUNNING_ACTION in out Message (#9368)
new 4a14e6d5261 CAMEL-19066: Do not copy correlationId after multicast (#9367)
new 3728b43c7e7 CAMEL-19066: Do not copy correlationId after multicast (#9367)
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../apache/camel/processor/MulticastProcessor.java | 7 ++++++-
...orTest.java => MulticastCorrelationIdTest.java} | 22 +++++++++++-----------
2 files changed, 17 insertions(+), 12 deletions(-)
copy core/camel-core/src/test/java/org/apache/camel/processor/{SimpleProcessorTest.java => MulticastCorrelationIdTest.java} (66%)
[camel] 01/02: CAMEL-19066: Do not copy correlationId after multicast (#9367)
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 4a14e6d526150450bc7269e659b6947472efe791
Author: Henning Garus <he...@gmail.com>
AuthorDate: Fri Feb 17 19:31:01 2023 +0100
CAMEL-19066: Do not copy correlationId after multicast (#9367)
Co-authored-by: Henning Garus <Âhenning.garusÂ@gmaiÃl.com>
---
.../apache/camel/processor/MulticastProcessor.java | 4 +-
.../processor/MulticastCorrelationIdTest.java | 49 ++++++++++++++++++++++
2 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java
index 2cc448af400..2a3c807fc7c 100644
--- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java
+++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java
@@ -800,8 +800,10 @@ public class MulticastProcessor extends AsyncProcessorSupport
// if we stopped due an exception then only propagate the exception
original.setException(subExchange.getException());
} else {
- // copy the current result to original so it will contain this result of this eip
+ // copy the current result to original, so it will contain this result of this eip
+ Object correlationId = subExchange.removeProperty(ExchangePropertyKey.CORRELATION_ID);
ExchangeHelper.copyResults(original, subExchange);
+ subExchange.setProperty(ExchangePropertyKey.CORRELATION_ID, correlationId);
}
}
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/MulticastCorrelationIdTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/MulticastCorrelationIdTest.java
new file mode 100644
index 00000000000..4c285b51d35
--- /dev/null
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/MulticastCorrelationIdTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class MulticastCorrelationIdTest extends ContextTestSupport {
+
+ @Test
+ void testCorrelationIdIsNotOverwrittenByMulticast() {
+ String originalCorrelationId = "SOME_ID";
+ Exchange exchange
+ = template.request("direct:start", e -> e.setProperty(Exchange.CORRELATION_ID, originalCorrelationId));
+
+ assertEquals(originalCorrelationId, exchange.getProperty(Exchange.CORRELATION_ID));
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("direct:start").multicast().to("direct:a", "direct:b");
+ from("direct:a").log("Route a");
+ from("direct:b").log("Route b");
+ }
+ };
+ }
+
+}
[camel] 02/02: CAMEL-19066: Do not copy correlationId after multicast (#9367)
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3728b43c7e7018e0bc4ff0e1c01e8d86d3d5ee8b
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Feb 17 19:33:37 2023 +0100
CAMEL-19066: Do not copy correlationId after multicast (#9367)
---
.../main/java/org/apache/camel/processor/MulticastProcessor.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java
index 2a3c807fc7c..8497deef8fe 100644
--- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java
+++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java
@@ -800,10 +800,13 @@ public class MulticastProcessor extends AsyncProcessorSupport
// if we stopped due an exception then only propagate the exception
original.setException(subExchange.getException());
} else {
- // copy the current result to original, so it will contain this result of this eip
+ // copy the current result to original (preserve original correlation id),
+ // so it will contain this result of this eip
Object correlationId = subExchange.removeProperty(ExchangePropertyKey.CORRELATION_ID);
ExchangeHelper.copyResults(original, subExchange);
- subExchange.setProperty(ExchangePropertyKey.CORRELATION_ID, correlationId);
+ if (correlationId != null) {
+ subExchange.setProperty(ExchangePropertyKey.CORRELATION_ID, correlationId);
+ }
}
}