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:38:29 UTC
(camel) branch main updated: CAMEL-20545: Using replaceFromWith with camel-test and having route templates can lead to duplicate consumer on starutp error. (#13485)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 8aab61a7a28 CAMEL-20545: Using replaceFromWith with camel-test and having route templates can lead to duplicate consumer on starutp error. (#13485)
8aab61a7a28 is described below
commit 8aab61a7a286f6c0ed34433c068ca065084dc67d
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Mar 14 14:38:23 2024 +0100
CAMEL-20545: Using replaceFromWith with camel-test and having route templates can lead to duplicate consumer on starutp error. (#13485)
---
.../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());