Claus Ibsen created CAMEL-28101:
-----------------------------------

             Summary: camel-core - a route configuration removed from a file, 
or in a deleted file, is never removed when the routes are reloaded
                 Key: CAMEL-28101
                 URL: https://issues.apache.org/jira/browse/CAMEL-28101
             Project: Camel
          Issue Type: Bug
          Components: camel-core
            Reporter: Claus Ibsen
             Fix For: 4.25.0


h3. Problem
On route reload, {{DefaultRoutesLoader.doUpdateRoutes}} updates the route 
configurations of the changed file with 
{{RouteConfigurationBuilder.updateRouteConfigurationsToCamelContext}}, which 
removes and adds again only the configurations whose ids are in the new version 
of the file. As a result:
* a route configuration that was removed from a file stays in the model, also 
with the default {{removeAllRoutes=true}}, and the reloaded routes still merge 
it;
* {{RouteWatcherReloadStrategy}} skips a deleted file ({{Files.exists}}, 
{{core/camel-support/.../RouteWatcherReloadStrategy.java:635}} and {{:1009}}), 
so the route configurations of a deleted file stay too.

Observed: {{cfgB}} removed from {{cfg.xml}} still applies to route {{r2}} after 
a full reload.

h3. Proposed fix
Remember the resource of each route configuration, and on reload remove the 
configurations of a resource that is gone or no longer declares them, as 
{{removeRouteTemplatesFromResources}} does for route templates (CAMEL-25619). 
CAMEL-25142 step 1 then refreshes the routes that used them.

Tests (file based, with {{@TempDir}} and Awaitility): remove a configuration 
from a file; delete a configuration file; both with {{removeAllRoutes=true}} 
and {{false}}.

Found while analysing CAMEL-25142 (late binding of cross-cutting features), 
with probe tests on main (4a354d948e9c).

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to