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 2024/03/14 13:24:52 UTC

(camel) branch replacefrom created (now 9b1e69e28a0)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch replacefrom
in repository https://gitbox.apache.org/repos/asf/camel.git


      at 9b1e69e28a0 CAMEL-20545: Using replaceFromWith with camel-test and having route templates can lead to duplicate consumer on starutp error.

This branch includes the following new commits:

     new 9b1e69e28a0 CAMEL-20545: Using replaceFromWith with camel-test and having route templates can lead to duplicate consumer on starutp error.

The 1 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.



(camel) 01/01: CAMEL-20545: Using replaceFromWith with camel-test and having route templates can lead to duplicate consumer on starutp error.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch replacefrom
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 9b1e69e28a0979c2b03bc179a6bc854c7d026f81
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Mar 14 14:22:33 2024 +0100

    CAMEL-20545: Using replaceFromWith with camel-test and having route templates can lead to duplicate consumer on starutp error.
---
 .../main/java/org/apache/camel/model/FromDefinition.java | 16 ++++++++++++++++
 .../org/apache/camel/model/RouteTemplateDefinition.java  |  3 ++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/FromDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/FromDefinition.java
index dc5d4b95665..4117dc5efc1 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/FromDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/FromDefinition.java
@@ -66,6 +66,22 @@ public class FromDefinition extends OptionalIdentifiedDefinition<FromDefinition>
         setEndpointConsumerBuilder(endpointConsumerBuilder);
     }
 
+    FromDefinition copy() {
+        FromDefinition copy = new FromDefinition();
+        copy.parent = this.parent;
+        copy.endpoint = this.endpoint;
+        copy.endpointConsumerBuilder = this.endpointConsumerBuilder;
+        copy.uri = this.uri;
+        copy.variableReceive = this.variableReceive;
+        copy.setCamelContext(this.getCamelContext());
+        copy.setId(this.getId());
+        copy.setCustomId(this.getCustomId());
+        copy.setDescription(this.getDescription());
+        copy.setLineNumber(this.getLineNumber());
+        copy.setLocation(this.getLocation());
+        return copy;
+    }
+
     @Override
     public String toString() {
         return "From[" + getLabel() + "]";
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/RouteTemplateDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/RouteTemplateDefinition.java
index 44802872d58..baeecddbff1 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/RouteTemplateDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/RouteTemplateDefinition.java
@@ -410,7 +410,8 @@ public class RouteTemplateDefinition extends OptionalIdentifiedDefinition<RouteT
         copy.setDelayer(route.getDelayer());
         copy.setGroup(route.getGroup());
         copy.setInheritErrorHandler(route.isInheritErrorHandler());
-        copy.setInput(route.getInput());
+        // make a defensive copy of the input as input can be adviced during testing or other changes
+        copy.setInput(route.getInput().copy());
         copy.setInputType(route.getInputType());
         copy.setLogMask(route.getLogMask());
         copy.setMessageHistory(route.getMessageHistory());