davsclaus opened a new pull request, #26666:
URL: https://github.com/apache/camel/pull/26666

   Fixes https://issues.apache.org/jira/browse/CAMEL-24866
   
   With a dev-mode app whose route file holds several routes, adding a second 
route file to the directory made the reload stop all routes and then fail:
   
   ```
   WARN  FileWatcherResourceReloadStrategy : Error reloading routes from file: 
.../hello.camel.yaml
   org.apache.camel.FailedToStartRouteException: Failed to start route: 
create-table because: duplicate route id detected create-table.
   ```
   
   `RouteWatcherReloadStrategy.onRouteReload` collected the sources to load 
again from every existing route, adding the route's source resource each time 
and only skipping the changed resource. A file with N routes was added N times, 
`DefaultRoutesLoader.updateRoutes` loaded it N times, and the second copy 
tripped the duplicate id check. A change to an existing file was fine because 
that file is the excluded one.
   
   The fix adds a source once per location, with the `equalResourceLocation` 
comparison the method already uses. Test: `RouteReloadNewFileTest` (fails with 
the duplicate id error without the change). Found with the camel-jbang-mcp 
server stepwise benchmark, where the model added a route file next to the 
example's three-route file and the app went down.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01Bp3538HRBPMQkb5ta9xRaj


-- 
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