camel-quarkus
camel-quarkus copied to clipboard
Add extension DSL modeline
Fixes #3834
@davsclaus could you review please ?
@davsclaus I want to make sure, it's an extension needed.
Needs an integration test
@davsclaus @jamesnetherton I'm trying to get some examples in the project. The lookup of properties doesn't work out of the box.
This line of code doesn't get the expected result.
The reason behind is that the property is not available in the camel-microprofile-config
propertiesComponent.
Any idea how can I bind those camel-dsl-modeline properties?
Yes you cannot test it as if that is added to the property - the modeline is in use during route creations and are available for these routes.
Can you try to get the property trait via
PropertiesComponent pc = camelContext.getPropertiesComponent();
PropertiesSource ps = pc.getPropertiesSource("property");
Yes you cannot test it as if that is added to the property - the modeline is in use during route creations and are available for these routes.
Can you try to get the property trait via
PropertiesComponent pc = camelContext.getPropertiesComponent(); PropertiesSource ps = pc.getPropertiesSource("property");
@davsclaus Nope, but I guess the way I test is not okay.
When you say the modeline is in use during route creations
. Is having the dependency is enough, or do we need to configure the context before starting the routes ?
@davsclaus what makes this propertiesSource different from null. I'm missing the part of what init this one.
Its loaded via classpath service detection https://github.com/apache/camel/blob/2245f5c1eb1c63ec0beaaf598cc476bb6038a1ff/dsl/camel-dsl-modeline/src/generated/resources/META-INF/services/org/apache/camel/properties-source-factory
Which is done on startup at https://github.com/apache/camel/blob/main/core/camel-base/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java#L740
It may be that camel-quarkus need some "build step" code that detect that camel-modeline-dsl is on the classpath and automatic loads the properties source and enlist in the registry.
For what its worth is similar to how many of the other optional services in Camel are auto-detect from classpath, where quarkus has some build time optimizations.
@davsclaus thanks for all the explanations. I resolved it by adding the trait via a recorder on Runtime Init. I'll add more tests, and try native mode, so I'm keeping this one as draft.
The PR is ready for reviews. I've added integrations tests and native support