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

   Step 9 of [CAMEL-25388](https://issues.apache.org/jira/browse/CAMEL-25388): 
`camel run --background` reports whether the integration started, keeps its 
output, and `camel run` fails early on input it cannot run.
   
   ### Background startup
   - `--background-wait` takes how long to wait: millis or a duration such as 
`2m`, default `60s` (it was a hardcoded 20 seconds). `true` (or no value) is 60 
seconds, `false` does not wait, as before. A custom picocli parameter consumer 
(`BackgroundWait`) takes the next argument only when it is such a value, so 
`--background-wait hello.yaml` still runs `hello.yaml`.
   - An integration that is still starting after the wait exits `124` with the 
path of its log, and is left running (it exited `0`). One that fails to start 
prints its log and exits with its exit code, as before.
   - One helper strips `--background` and `--background-wait` (with a separate 
value) from the arguments of the integration in the background (`Run` ×3, 
`Debug`).
   
   ### The log
   - The output of an integration in the background goes to 
`~/.camel/<pid>-run.log` (`BackgroundLog`), and the path is printed. The log is 
kept while the integration runs (it had a random name and was removed after 
startup); `camel stop` removes it once the integration has exited, and `camel 
dirty` the log of one that is gone.
   - `--background-wait=false` sends the output to the log too: it went to a 
pipe that nobody read.
   - `camel restart` (CAMEL-25395) uses the same log for the new integration 
and removes the old one.
   - The runs of export and transform keep the old behaviour: quiet, and the 
log is removed after startup.
   
   ### Input errors
   - A file that does not exist exits `3` with `File does not exist: <file>` 
for every extension, before the configuration is printed (`.yaml` and `.xml` 
said `File not found: Source file '...' does not exist`).
   - An integration that loads no routes exits `1` with `No routes found in: 
<files>` instead of running idle. Not with `--source-dir`, `--empty` or dev 
mode (files can be added or changed later), `--ignore-loading-error`, nor the 
runs of export, transform and `camel script`.
   - Files together with `--source-dir`, and `--background` with the Spring 
Boot, Quarkus or Camel Main runtime, exit `2` (it was `1`).
   
   ### Dev mode limits
   - `camel dev` / `camel run --dev` with `--max-seconds`, `--max-messages` or 
`--max-idle-seconds` exit at the limit. CAMEL-17223 made dev mode stop the 
routes instead of the JVM when a limit is hit, so a reload can start them 
again; that stays for limits from the configuration 
(`camel.main.durationMax*`), but a limit given on the command line asks for a 
bounded run.
   
   ### Docs
   - 4.24 upgrade guide: "camel run: startup in the background, and input 
errors".
   - `camel-jbang-managing.adoc`: running in the background.
   
   ### Tests
   - `BackgroundWaitTest`: values, the optional value with a file after it, 
stripping the options.
   - `BackgroundLogTest`: the output of a real process lands in 
`<pid>-run.log`, `tail`.
   - `StopProcessTest`: the log is removed once the integration has stopped, 
and kept with `--no-wait`.
   - `CommandInputErrorsTest`: a missing file for each extension (exit 3, 
nothing printed), files with `--source-dir` and Quarkus with `--background` 
(exit 2).
   - `RunTest`: when an integration is expected to have routes.
   - Real processes with the launcher jar: missing file (3), routes in a 
template only (1), a foreground run with `--max-seconds`, `--background` (log 
path printed, removed by `camel stop`), a template in the background (1 with 
the log), `--background-wait=1` (124, left running), `--background-wait=false` 
(the output lands in the log), a bare `--background-wait` before the file, and 
dev mode with `--max-seconds=4` (exits after the limit).
   - `mvn test` of camel-jbang-core: all tests pass.
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01DDRLJAyf8cDXSg8iX785My
   


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