davsclaus opened a new pull request, #27774: URL: https://github.com/apache/camel/pull/27774
[CAMEL-25616](https://issues.apache.org/jira/browse/CAMEL-25616) Two regressions from #27745 (CAMEL-25554) and #27751 (CAMEL-25598), reported by @allthingssecurity in late comments after both were merged (thanks for the reproducers, both are tests here now). **1. `routesReloadRemoveAllRoutes=false`: a `templatedRoute` without a `routeId` was added again on every reload.** The "same template replaces the existing route" rule in `DefaultModel.doAddRouteFromTemplate` only applies when the route has an id, so a route with a generated id was created next to the old one (duplicates, or `Multiple consumers for the same endpoint` with `direct:`). `RouteBuilder.updateTemplatedRoutesToCamelContext` now only updates templated routes that have a route id; one without an id is left as it is, as before #27745. **2. `routesReloadRemoveAllRoutes=true`: a reload of any file removed all routes when the route template is defined in Java.** With the template from `context.addRoutes(new RouteBuilder() ...)` (no resource) and the `templatedRoute` in a watched file, `RouteWatcherReloadStrategy` loaded the templated route file again, but `removeRouteTemplates("*")` had removed the Java template and nothing added it again, so the reload failed, the restore failed the same way, and the application ran without routes. The file with the templated route is now only loaded again when its route template comes from a file (`getSourceResource() != null`), as before #27751. Both new tests fail without the change. Ran locally: the camel-yaml-dsl `RouteReload*` tests (17), the camel-core reload and route template tests (124), and camel-main `MainTemplatedRoute*` (4). Follow-ups, not in this PR (not regressions): - keep a route template defined in Java across a reload, so its templated route from a file is reloaded too (needs a way to remove only the templates that are loaded again); - reload a route template file that is used through `kamelet:` (same behaviour on main before #27751). No upgrade guide change: the behaviour returns to that of 4.23 for both cases. _Claude Code on behalf of @davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
