davsclaus opened a new pull request, #27000: URL: https://github.com/apache/camel/pull/27000
Fixes [CAMEL-25098](https://issues.apache.org/jira/browse/CAMEL-25098): bugs found in a deep review of the bootstrap of camel-main. ## Fixed 1. **The `dev` profile overrode options set with a key in another case or with dashes.** For example, the ENV variable `CAMEL_MAIN_SHUTDOWNTIMEOUT=5` becomes `camel.main.shutdowntimeout`, and `camel.main.shutdown-timeout` also missed. `ProfileConfigurer` now matches keys regardless of case and dashes. 2. **SSL was auto-configured twice.** A duplicated block in `BaseMainSupport` generated the self-signed certificate twice and replaced the `SSLContextParameters` after the HTTP server had been configured. The duplicate is removed. 3. **`durationMaxSeconds=-1` with `durationMaxAction=stop` was a busy loop.** After stopping the routes, Main now waits until it is shut down. 4. **`MainDurationEventNotifier` never stopped its idle scheduler thread.** That thread is non-daemon, so the JVM did not exit when Main was embedded or used in tests. The scheduler now comes from the `ExecutorServiceManager` and is shut down in `doStop`. 5. **The idle trigger with `durationMaxAction=stop` fired every second.** It now fires once, until there is new activity. 6. **`durationMaxAction` is now case-insensitive in the event notifier.** `STOP` used to fail with "Unknown action: null", and the error now shows the given value. 7. **The modeline scan ignored route collector options from properties.** It runs before the routes are loaded and did not honour `routesExcludePattern`, `routesCollectorEnabled` or `routesCollectorIgnoreLoadingError`, so an excluded file was still pre-parsed. These options are now resolved eagerly, like `routesIncludePattern`. 8. **`Main` loaded the wrong profile's properties file.** It loaded the file of the profile configured in Java (`withProfile("dev")`) as well as the one from `-Dcamel.main.profile=prod`. The base class already adds the profile file, with SYS/ENV taking precedence, so the extra prepend in `MainCommandLineSupport` is removed. 9. **Whether a JVM system property overrode an ENV variable depended on the case of the keys**, including for `autoConfigurationFailFast`. ENV and SYS properties now replace existing keys regardless of case, so SYS always wins over ENV. Cleanup: the auto-configuration summary now uses the key `camel.main.autoConfigurationSystemPropertiesEnabled` (previously `.main.` was missing). The upgrade guide covers 1, 6, 8 and 9. ## Not changed - ENV variables ending with `_PORT`, such as `CAMEL_SERVER_PORT`, are still ignored, because Kubernetes injects `<SERVICE>_PORT` variables. ## Tests - **New `MainBootstrapEdgeCasesTest`** with 9 tests, all of which fail without the fix. - It is marked `@Isolated` because it uses JVM system properties and captures logging. - Awaitility is added as a test dependency to camel-main. - **Full camel-main suite:** all 260 tests pass. _Claude Code on behalf of Claus Ibsen_ 🤖 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]
