davsclaus commented on code in PR #27467:
URL: https://github.com/apache/camel/pull/27467#discussion_r4203983429


##########
core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java:
##########
@@ -645,6 +645,13 @@ protected String doAddRouteFromTemplate(
         if (group != null) {
             def.setGroup(group);
         }
+        // a route from a template (or a Kamelet) must not replace an existing 
route with the same id
+        String id = def.getId();
+        if (id != null && (getRouteDefinition(id) != null || 
camelContext.getRoute(id) != null)) {

Review Comment:
   This also fires for a Kamelet endpoint that re-creates its own route after 
the parent route was removed and added again (see the test in the review 
summary).



##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc:
##########
@@ -501,6 +501,13 @@ The 
`org.apache.camel.processor.InterceptSendToEndpointCallback` class is deprec
 - A hardcoded node id in a route template no longer clashes with the same id 
in a regular route, as the ids of
   the route created from the template are prefixed.
 
+==== A route id that is already used (Breaking change)
+
+Creating a route from a route template (`TemplatedRouteBuilder`, 
`templatedRoute`, `addRouteFromTemplate`, or a
+Kamelet endpoint with a route id) with the id of an existing route now fails 
with
+`FailedToCreateRouteFromTemplateException`. Prior to Camel 4.23 the existing 
route was removed and replaced without

Review Comment:
   For a Kamelet endpoint the error is wrapped in 
`FailedToCreateKameletException` (the test asserts the root cause), so this 
sentence is only accurate for the other cases. Please update it together with 
the Kamelet change.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to