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

   [CAMEL-25661](https://issues.apache.org/jira/browse/CAMEL-25661)
   
   `camel_write_file` and `camel_edit_file` wait for dev mode to reload the 
file they wrote. Dev mode finds a change at its next folder scan, every 2000 
ms, so each accepted write waits about a second for the scan alone. This takes 
the cheaper variant from the issue comment: a configurable scan interval, and 
500 ms for the integrations `camel_run` starts.
   
   ## Changes
   - **camel-main:** new option `camel.main.routesReloadInterval` (millis, 
default 2000) sets how often dev mode scans the reload directory. 
`FileWatcherResourceReloadStrategy.setPollTimeout` could not be set from 
configuration before. The strategy now also shows the interval as a JMX 
attribute. An interval of 0 or less keeps the default, since 0 would scan 
without a pause.
   - **`camel_run` (shared AI tools in camel-jbang-core):** starts integrations 
in dev mode with `--prop=camel.main.?routesReloadInterval=500`. `camel run 
--dev` for people keeps 2000 ms. Each write tool call writes one file and waits 
for its reload, so the shorter interval does not split one change into two 
reloads.
   - **`ReloadOutcome`:**
     - The write tools now read the log tail every 100 ms, both while waiting 
for the reload (was 500 ms) and for the routes' output after it (was 300 ms).
     - The routes reload after the properties they use. So when a properties 
reload is seen, the tools watch 500 ms longer for the routes reload that 
follows, and its outcome (reloaded or failed) becomes the answer. Before, which 
answer you got depended on where the 500 ms poll fell.
   - **Docs:** `route-reload.adoc` (options table), `camel-jbang-running.adoc` 
(dev mode) and `camel-jbang-mcp.adoc` (`camel_run`). Regenerated: the 
configurer, the main metadata and `main.adoc`, plus their catalog copies.
   
   ## Older camel on the PATH
   `camel_run` starts the `camel` command, which can be older than the tools: 
for example the MCP server run as `LATEST` with an older `camel` on the PATH, 
or `--camel-version`. Checked with a 4.23.0-SNAPSHOT CLI, which does not have 
the option:
   - `--prop=camel.main.routesReloadInterval=500` stops the start with a 
`PropertyBindingException`.
   - `--prop=camel.main.?routesReloadInterval=500` (the optional key) logs one 
WARN, "Property not auto-configured", and the integration starts.
   
   So the launcher passes the optional key. `MainRoutesReloadIntervalTest` 
checks that the new camel-main binds it.
   
   ## Tests
   - `MainRoutesReloadIntervalTest` (new): default 2000, the configured 
interval, the optional key, and 0 keeps the default.
   - `ReloadOutcomeTest`: a properties reload is answered with the routes 
reload after it, or as a properties reload when none follows.
   - `IntegrationLauncherTest`: the dev-mode arguments.
   
   `mvn verify` on camel-support, camel-main and camel-jbang-core, running the 
touched tests: all pass.
   
   ## Effect
   Not re-measured on this branch. The issue comment measured 2.52 s median per 
accepted write with the 2000 ms scan and 1.49 s with 250 ms, over 294 and 99 
writes. At 500 ms the median should land near 1.7 s, plus about 0.2 s from the 
faster log reads.
   
   🤖 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]

Reply via email to