allthingssecurity commented on code in PR #27467:
URL: https://github.com/apache/camel/pull/27467#discussion_r4204477349
##########
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:
Fixed in 4ff3e46b2105: the check now fails only when the existing route was
not created from the same template. `doAddRouteFromTemplate` records the
template id on the route definition (`RouteDefinition.getRouteTemplateId()`,
transient), so a Kamelet route that is created again for its re-added or
updated parent route replaces its previous route, as on main. A regular route,
or a route from another template or Kamelet, with that id still fails.
_Claude Code on behalf of allthingssecurity_
##########
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:
Updated in 4ff3e46b2105: for a Kamelet endpoint the note now says the
exception is wrapped in `FailedToCreateKameletException`. It also lists which
cases fail (a regular route, or a route from another template or Kamelet) and
says that a route from the same template is still replaced.
_Claude Code on behalf of allthingssecurity_
--
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]