davsclaus opened a new pull request, #28125: URL: https://github.com/apache/camel/pull/28125
[CAMEL-25834](https://issues.apache.org/jira/browse/CAMEL-25834): in dev mode, the files of one scan of the folder are reloaded together (CAMEL-25041, 4.23.0). When a properties file of such a batch failed, the failure was only logged at DEBUG. There was no WARN, no failed counter and no reload failure event, and the routes reloaded as if all went well. The cause: when the batch failed, `RouteWatcherReloadStrategy.onReloadBatch` reloaded the files again one at a time, to find the file that is wrong (CAMEL-24860). A properties file fails after the properties component has taken its new values, when the configuration in it is applied (`PropertiesReload.onReload`). So when it was reloaded on its own, it had no changes left, and nothing failed. - Each properties or Groovy file of a batch is reloaded on its own. A failure is reported as when the file changed alone: a WARN, the failed counter, the last error, and the reload failure event (`FileWatcherResourceReloadStrategy.reloadFailed`, which the reload of a single file now uses too). The other files of the batch still reload. - Reloading one at a time stays for the route files, where it finds the file that is wrong. - The WARN is the same line as for a single file (`Error reloading routes from file: ... This exception is ignored.`), so the AI tools that read the reload outcome from the log (`ReloadOutcome`) see it too. The LTS lines 4.18.x and 4.22.x do not have the batch reload, so there is nothing to backport. ## Tests - New `RouteWatcherReloadBatchFailureTest` (camel-core, 2): - A properties file whose configuration fails, saved together with a route: the failure is reported (WARN with the file and the cause, failed counter, last error, one reload failure event), and the route still reloads, once. - Two properties files, one of which fails: the failure is reported, and the other file is still applied. - Without the change, both fail: no WARN at all. - The reload tests of camel-core (35), camel-yaml-dsl (13), camel-xml-io-dsl (3), camel-main (4) and camel-jbang-core (`ReloadOutcomeTest`, 8) pass. - End to end, with `camel run tick.camel.yaml application.properties --dev` and one line appended to application.properties that refers to a bean that does not exist (`camel.component.log.exchange-formatter = #bean:noSuchFormatter`): | Launcher | Saved | WARN for application.properties | |---|---|---| | main | alone | 1 | | main | together with a change to the route | **0** | | this branch | together with a change to the route | **1** | The WARN: `Error reloading routes from file: application.properties due to: Error binding property (camel.component.log.exchangeFormatter=#bean:noSuchFormatter) ...`. In all three runs, the route reloads when it changed. Noted first in CAMEL-25833, where a dependency added in a reload made the bean class unknown, and the failure was lost when the route was saved in the same scan. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m -- 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]
