[ https://issues.apache.org/jira/browse/CAMEL-21484?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen updated CAMEL-21484: -------------------------------- Issue Type: Improvement (was: Bug) > DefaultPropertiesLookup loads all props from microprofile config per property > value lookup > ------------------------------------------------------------------------------------------ > > Key: CAMEL-21484 > URL: https://issues.apache.org/jira/browse/CAMEL-21484 > Project: Camel > Issue Type: Improvement > Components: camel-microprofile-config > Affects Versions: 4.8.1 > Reporter: Paul Blanchaert > Priority: Minor > > While using quarkus to run camel route, all microprofile properties are > loaded per lookup of a property value. So when using a modest number of 10 > config values in camel routes, the current lookup loads all properties > (including environment and system variables) 11 times. > This happens in the method DefaultPropertiesLookup# > doLookup(String name, String defaultValue). When a property is found (answer > != null), then the source is determined: for the > CamelMicroProfilePropertiesSource, the routine performs the loadProperties() > function (in the block "ps instanceof LoadablePropertiesSource") to retrieve > the "source" string for the retrieved value. This is set when " > prop instanceof OrderedLocationProperties". For this > CamelMicroProfilePropertiesSource, this prop is not an instanceof > OrderedLocationProperties, and so the result of the loadProperties call is > never used and hence should be avoided. > This can be illustrated with the following setup with 3 mymsg properties: > route.yaml: > {{- from:}} > {{ uri: "timer:myyaml"}} > {{ steps:}} > {{ - log:}} > {{ message: 'Message \{{mymsg}} \{{mymsg2:msg2}} \{{mymsg3:msg3}} > \{{mymsg4:msg4}}'}} > > application.properties: > {{quarkus.config.log.values=true}} > {{quarkus.log.level=info}} > {{quarkus.log.category."org.apache.camel.main".level=DEBUG}} > {{quarkus.log.category."org.apache.camel.component.properties".level=DEBUG}} > {{quarkus.log.category."io.smallrye.config".level=DEBUG}} > {{camel.main.routes-include-pattern=camel/route.yaml}} > {{mymsg=test1}} > {{mymsg2=test2}} > {{mymsg3=test3}} > > {{-> % quarkus run -B | grep mymsg}} > {{2024-11-28 10:22:58,942 DEBUG [org.apa.cam.mai.RoutesConfigurer] (main) > Adding templated routes into CamelContext from RoutesBuilder: Routes: > [Route[From[timer:myyaml] -> [Log[Message \{{mymsg}} \{{mymsg2:msg2}} > \{{mymsg3:msg3}} \{{mymsg4:msg4}}]]]]}} > {{2024-11-28 10:22:58,958 DEBUG [io.sma.config] (main) SRCFG01001: The config > mymsg was loaded from > PropertiesConfigSource[source=jar:file:///private/tmp/test1/target/quarkus-app/app/test1-1.0.0-SNAPSHOT.jar!/application.properties]:12 > with the value test1}} > {{2024-11-28 10:22:58,960 DEBUG [io.sma.config] (main) SRCFG01001: The config > mymsg was loaded from > PropertiesConfigSource[source=jar:file:///private/tmp/test1/target/quarkus-app/app/test1-1.0.0-SNAPSHOT.jar!/application.properties]:12 > with the value test1}} > {{2024-11-28 10:22:58,960 DEBUG [io.sma.config] (main) SRCFG01001: The config > mymsg2 was loaded from > PropertiesConfigSource[source=jar:file:///private/tmp/test1/target/quarkus-app/app/test1-1.0.0-SNAPSHOT.jar!/application.properties]:13 > with the value test2}} > {{2024-11-28 10:22:58,960 DEBUG [io.sma.config] (main) SRCFG01001: The config > mymsg3 was loaded from > PropertiesConfigSource[source=jar:file:///private/tmp/test1/target/quarkus-app/app/test1-1.0.0-SNAPSHOT.jar!/application.properties]:14 > with the value test3}} > {{2024-11-28 10:22:58,966 DEBUG [org.apa.cam.com.pro.DefaultPropertiesParser] > (main) Found property: mymsg with value: test1 to be used.}} > {{2024-11-28 10:22:58,966 DEBUG [io.sma.config] (main) SRCFG01001: The config > mymsg2 was loaded from > PropertiesConfigSource[source=jar:file:///private/tmp/test1/target/quarkus-app/app/test1-1.0.0-SNAPSHOT.jar!/application.properties]:13 > with the value test2}} > {{2024-11-28 10:22:58,966 DEBUG [io.sma.config] (main) SRCFG01001: The config > mymsg was loaded from > PropertiesConfigSource[source=jar:file:///private/tmp/test1/target/quarkus-app/app/test1-1.0.0-SNAPSHOT.jar!/application.properties]:12 > with the value test1}} > {{2024-11-28 10:22:58,967 DEBUG [io.sma.config] (main) SRCFG01001: The config > mymsg2 was loaded from > PropertiesConfigSource[source=jar:file:///private/tmp/test1/target/quarkus-app/app/test1-1.0.0-SNAPSHOT.jar!/application.properties]:13 > with the value test2}} > {{2024-11-28 10:22:58,967 DEBUG [io.sma.config] (main) SRCFG01001: The config > mymsg3 was loaded from > PropertiesConfigSource[source=jar:file:///private/tmp/test1/target/quarkus-app/app/test1-1.0.0-SNAPSHOT.jar!/application.properties]:14 > with the value test3}} > {{2024-11-28 10:22:58,972 DEBUG [org.apa.cam.com.pro.DefaultPropertiesParser] > (main) Found property: mymsg2 with value: test2 to be used.}} > {{2024-11-28 10:22:58,973 DEBUG [io.sma.config] (main) SRCFG01001: The config > mymsg3 was loaded from > PropertiesConfigSource[source=jar:file:///private/tmp/test1/target/quarkus-app/app/test1-1.0.0-SNAPSHOT.jar!/application.properties]:14 > with the value test3}} > {{2024-11-28 10:22:58,973 DEBUG [io.sma.config] (main) SRCFG01001: The config > mymsg was loaded from > PropertiesConfigSource[source=jar:file:///private/tmp/test1/target/quarkus-app/app/test1-1.0.0-SNAPSHOT.jar!/application.properties]:12 > with the value test1}} > {{2024-11-28 10:22:58,973 DEBUG [io.sma.config] (main) SRCFG01001: The config > mymsg2 was loaded from > PropertiesConfigSource[source=jar:file:///private/tmp/test1/target/quarkus-app/app/test1-1.0.0-SNAPSHOT.jar!/application.properties]:13 > with the value test2}} > {{2024-11-28 10:22:58,973 DEBUG [io.sma.config] (main) SRCFG01001: The config > mymsg3 was loaded from > PropertiesConfigSource[source=jar:file:///private/tmp/test1/target/quarkus-app/app/test1-1.0.0-SNAPSHOT.jar!/application.properties]:14 > with the value test3}} > {{2024-11-28 10:22:58,978 DEBUG [org.apa.cam.com.pro.DefaultPropertiesParser] > (main) Found property: mymsg3 with value: test3 to be used.}} > {{2024-11-28 10:22:58,978 DEBUG [io.sma.config] (main) SRCFG01002: The config > mymsg4 was not found}} > {{2024-11-28 10:22:58,978 DEBUG [io.sma.config] (main) SRCFG01002: The config > mymsg4 was not found}} > {{2024-11-28 10:22:58,978 DEBUG [org.apa.cam.com.pro.DefaultPropertiesParser] > (main) Property with key [mymsg4] not found, using default value: msg4}} > {{2024-11-28 10:22:58,990 INFO [org.apa.cam.mai.BaseMainSupport] (main) > [MicroProfilePropertiesSource] mymsg = test1}} > {{2024-11-28 10:22:58,990 INFO [org.apa.cam.mai.BaseMainSupport] (main) > [MicroProfilePropertiesSource] mymsg2 = test2}} > {{2024-11-28 10:22:58,990 INFO [org.apa.cam.mai.BaseMainSupport] (main) > [MicroProfilePropertiesSource] mymsg3 = test3}} > -- This message was sent by Atlassian Jira (v8.20.10#820010)