This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new ca0b490 CAMEL-13683: camel-main - configuring properties report
better error if missing JARs on classpathand other mistakes.
ca0b490 is described below
commit ca0b490a375b2b50156f728f85eb3566e02b96d3
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Jun 26 18:03:25 2019 +0200
CAMEL-13683: camel-main - configuring properties report better error if
missing JARs on classpathand other mistakes.
---
.../java/org/apache/camel/main/MainSupport.java | 39 ++++++++++++++++++----
1 file changed, 33 insertions(+), 6 deletions(-)
diff --git
a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
index 3d0e4db..b0879e5 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
@@ -789,6 +789,14 @@ public abstract class MainSupport extends ServiceSupport {
Object failFast =
propENV.remove("camel.main.autoconfigurationfailfast");
if (failFast != null) {
PropertyBindingSupport.bindMandatoryProperty(camelContext,
mainConfigurationProperties, "autoConfigurationFailFast", failFast, true);
+ } else {
+ failFast = prop.remove("camel.main.autoConfigurationFailFast");
+ if (failFast == null) {
+ failFast =
prop.remove("camel.main.auto-configuration-fail-fast");
+ }
+ if (failFast != null) {
+ PropertyBindingSupport.bindMandatoryProperty(camelContext,
mainConfigurationProperties, "autoConfigurationFailFast", failFast, true);
+ }
}
}
@@ -843,7 +851,7 @@ public abstract class MainSupport extends ServiceSupport {
}
}
- Map<String, Object> properties = new LinkedHashMap<>();
+ Map<String, Object> contextProperties = new LinkedHashMap<>();
Map<String, Object> hystrixProperties = new LinkedHashMap<>();
Map<String, Object> restProperties = new LinkedHashMap<>();
for (String key : prop.stringPropertyNames()) {
@@ -852,7 +860,7 @@ public abstract class MainSupport extends ServiceSupport {
String value = prop.getProperty(key);
String option = key.substring(14);
validateOptionAndValue(key, option, value);
- properties.put(optionKey(option), value);
+ contextProperties.put(optionKey(option), value);
} else if (key.startsWith("camel.hystrix.")) {
// grab the value
String value = prop.getProperty(key);
@@ -867,9 +875,9 @@ public abstract class MainSupport extends ServiceSupport {
restProperties.put(optionKey(option), value);
}
}
- if (!properties.isEmpty()) {
- LOG.info("Auto configuring CamelContext from loaded properties:
{}", properties.size());
- setPropertiesOnTarget(camelContext, camelContext, properties,
mainConfigurationProperties.isAutoConfigurationFailFast(), true);
+ if (!contextProperties.isEmpty()) {
+ LOG.info("Auto configuring CamelContext from loaded properties:
{}", contextProperties.size());
+ setPropertiesOnTarget(camelContext, camelContext,
contextProperties, mainConfigurationProperties.isAutoConfigurationFailFast(),
true);
}
if (!hystrixProperties.isEmpty()) {
LOG.info("Auto configuring Hystrix EIP from loaded properties:
{}", hystrixProperties.size());
@@ -892,7 +900,26 @@ public abstract class MainSupport extends ServiceSupport {
setPropertiesOnTarget(camelContext, rest, restProperties,
mainConfigurationProperties.isAutoConfigurationFailFast(), true);
}
- // TODO: Log which options was not set
+ // log which options was not set
+ if (!contextProperties.isEmpty()) {
+ contextProperties.forEach((k, v) -> {
+ LOG.warn("Property not auto configured: camel.context.{}={} on
object: {}", k, v, camelContext);
+ });
+ }
+ if (!hystrixProperties.isEmpty()) {
+ ModelCamelContext model =
camelContext.adapt(ModelCamelContext.class);
+ HystrixConfigurationDefinition hystrix =
model.getHystrixConfiguration(null);
+ hystrixProperties.forEach((k, v) -> {
+ LOG.warn("Property not auto configured: camel.hystrix.{}={} on
object: {}", k, v, hystrix);
+ });
+ }
+ if (!restProperties.isEmpty()) {
+ ModelCamelContext model =
camelContext.adapt(ModelCamelContext.class);
+ RestConfiguration rest = model.getRestConfiguration();
+ restProperties.forEach((k, v) -> {
+ LOG.warn("Property not auto configured: camel.rest.{}={} on
object: {}", k, v, rest);
+ });
+ }
}
protected void autoConfigurationPropertiesComponent(CamelContext
camelContext) throws Exception {