Skip to content

Commit

Permalink
CAMEL-20545: Using replaceFromWith with camel-test and having route t…
Browse files Browse the repository at this point in the history
…emplates can lead to duplicate consumer on starutp error. (apache#13485)
  • Loading branch information
davsclaus committed Mar 14, 2024
1 parent 9c29395 commit 8aab61a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Expand Up @@ -66,6 +66,22 @@ public FromDefinition(EndpointConsumerBuilder endpointConsumerBuilder) {
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() + "]";
Expand Down
Expand Up @@ -410,7 +410,8 @@ public RouteDefinition asRouteDefinition() {
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());
Expand Down

0 comments on commit 8aab61a

Please sign in to comment.