Claus Ibsen created CAMEL-25834:
-----------------------------------

             Summary: camel-core - dev mode: a properties file that fails to 
reload is not reported when another file changed in the same scan
                 Key: CAMEL-25834
                 URL: https://issues.apache.org/jira/browse/CAMEL-25834
             Project: Camel
          Issue Type: Bug
          Components: camel-core
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Since CAMEL-25041 (4.23.0), the files that change in one scan of the folder are 
reloaded together. {{RouteWatcherReloadStrategy.onReloadBatch}} applies the 
properties files first, and then reloads the routes once. When the batch fails, 
it logs the failure at DEBUG and reloads the files one at a time, so that the 
file that is wrong is named (CAMEL-24860).

That does not work for a properties file. Its reload fails after the properties 
component has taken the new values ({{PropertiesComponent.reloadProperties}}), 
when the configuration in it is applied ({{PropertiesReload.onReload}}). 
Reloaded on its own, the file has no changes left, so nothing happens and 
nothing fails. The failure is only in the DEBUG log: no WARN, no failed 
counter, no reload failure event. The routes reload as if all went well.

Reproduced with {{camel run --source-dir=. --dev}} and the camel launcher built 
from PR #28123 (CAMEL-25767, which creates the new beans of a reload), by 
appending to application.properties while the app runs:
{noformat}
camel.jbang.dependencies = com.github.javafaker:javafaker:1.0.2
camel.beans.faker = #class:com.github.javafaker.Faker
{noformat}
* Saved alone: {{WARN FileWatcherResourceReloadStrategy : Error reloading 
routes from file: application.properties due to: com.github.javafaker.Faker. 
This exception is ignored.}}, with the {{ClassNotFoundException}} (the class is 
not downloaded in a reload: CAMEL-25833).
* Saved together with a change to the route: only {{Reloading properties: 
file:application.properties}} and {{Routes reloaded summary}}. The bean is 
missing, and the log does not say why.

A coding agent often writes application.properties and a route one after the 
other, within one scan.

Proposal: in a batch, reload each properties file (and Groovy file) on its own, 
and report its failure as the reload of a single file does: WARN, failed 
counter, last error, and the reload failure event. 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 LTS lines 4.18.x and 4.22.x do not have the batch reload.

Noted first in CAMEL-25833.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to