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

   Item 1 of [CAMEL-26930](https://issues.apache.org/jira/browse/CAMEL-26930).
   
   ## Problem
   
   With `camel.jbang.background=true` in `application.properties`, `camel run` 
starts an endless chain of JVMs:
   
   1. The run reads the property and starts a JVM in the background, without 
`--background` in its arguments.
   2. That JVM reads the same `application.properties`, sees `background=true`, 
and starts its own child.
   3. Each child does the same.
   
   On the launcher from today's main: 10 JVMs after 10 seconds, and the route 
never started. `camel.jbang.jvmDebug` has the same shape, through the debug run.
   
   ## Change
   
   A run now marks every JVM it starts to run the integration with the 
environment variable `CAMEL_CLI_SPAWNED_RUN=true`. That covers a JVM in the 
background, the one with another Camel version or a debugger, and the one 
`camel debug` starts. A marked JVM runs the integration itself, so it ignores 
`camel.jbang.background`, `camel.jbang.backgroundWait` and 
`camel.jbang.jvmDebug` in the application properties. A run that is not marked 
reads them as before.
   
   The background log already marks its child the same way 
(`CAMEL_CLI_CONSOLE_LOG_LEVEL`).
   
   ## Tests
   
   - `RunTest`: the properties start another JVM in a normal run; in a marked 
JVM they do not; and `markSpawned` sets the variable.
   - End to end, with the unpacked launcher from main, an isolated home, and 
`camel.jbang.background=true` in the properties:
     - **Before:** 10 JVMs after 10 seconds.
     - **After** (patched `camel-jbang-core` jar): one JVM, reported as 
Running. `camel ps` shows it 1/1 Running, its route processes messages, and 
`camel stop <pid>` stops it.
   - The camel-jbang-core suite passes.
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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