Claus Ibsen created CAMEL-25098:
-----------------------------------

             Summary: camel-main - Bootstrap, profiles and duration options: 
fix bugs found in a deep review
                 Key: CAMEL-25098
                 URL: https://issues.apache.org/jira/browse/CAMEL-25098
             Project: Camel
          Issue Type: Bug
          Components: camel-main
            Reporter: Claus Ibsen


A review of the bootstrap of camel-main found these bugs:

# The {{dev}} profile overrides an option configured with a key in another case 
or with dashes, such as the ENV variable {{CAMEL_MAIN_SHUTDOWNTIMEOUT=5}} 
(which becomes {{camel.main.shutdowntimeout}}), 
{{CAMEL_MAIN_MESSAGEHISTORY=false}} or {{camel.main.shutdown-timeout}}, as 
ProfileConfigurer only checks the exact camelCase key.
# SSL ({{camel.ssl.*}}) is auto-configured twice (a duplicated block in 
BaseMainSupport), so a self-signed certificate is generated twice and the 
SSLContextParameters used by the HTTP server is replaced afterwards.
# {{camel.main.durationMaxSeconds=-1}} with {{durationMaxAction=stop}} is a 
busy loop, which stops all routes and logs about every millisecond.
# MainDurationEventNotifier does not stop its idle scheduler thread (a 
non-daemon thread), so the JVM does not exit when Main is used embedded or in 
tests.
# {{camel.main.durationMaxIdleSeconds}} with {{durationMaxAction=stop}} 
triggers stopping all routes again every second.
# {{durationMaxAction}} is case-insensitive in one place, but the event 
notifier only accepts lower case, so {{STOP}} fails with "Unknown action: null".
# Scanning the routes for modeline (before the routes are loaded) ignores 
{{camel.main.routesExcludePattern}}, {{routesCollectorEnabled}} and 
{{routesCollectorIgnoreLoadingError}} from the properties, so an excluded (or 
broken) route file is still pre-parsed.
# Main loads the properties file of the profile configured in Java 
({{withProfile("dev")}}) together with the profile from 
{{-Dcamel.main.profile=prod}}, so options of the dev profile leak into prod.
# Whether a JVM system property overrides the same option from an ENV variable 
depends on the case of the keys (for example {{CAMEL_MAIN_SHUTDOWNTIMEOUT=11}} 
and {{-Dcamel.main.shutdownTimeout=22}} gives 11), also for 
{{autoConfigurationFailFast}}.

Not changed:
* ENV variables ending with {{_PORT}} (such as {{CAMEL_SERVER_PORT}}) are 
ignored, as Kubernetes injects {{<SERVICE>_PORT}} variables for services.

_Claude Code on behalf of Claus Ibsen_



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

Reply via email to