CAMEL-9775: Cleanup the spring-boot auto config doc
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/fa8d7e31 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/fa8d7e31 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/fa8d7e31 Branch: refs/heads/camel-2.17.x Commit: fa8d7e314ad5ccff6a07683d9223f68d48b7e171 Parents: 6f05f0f Author: Claus Ibsen <davscl...@apache.org> Authored: Wed Mar 30 14:56:29 2016 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Wed Mar 30 14:58:44 2016 +0200 ---------------------------------------------------------------------- .../spring/boot/CamelAutoConfiguration.java | 26 ++++++++++++-------- .../boot/CamelConfigurationProperties.java | 19 ++++++++++++-- 2 files changed, 33 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/fa8d7e31/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java index e9e81d6..f950e52 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java @@ -21,6 +21,7 @@ import java.util.Collection; import org.apache.camel.CamelContext; import org.apache.camel.ConsumerTemplate; +import org.apache.camel.Exchange; import org.apache.camel.ProducerTemplate; import org.apache.camel.component.properties.PropertiesComponent; import org.apache.camel.component.properties.PropertiesParser; @@ -45,16 +46,21 @@ public class CamelAutoConfiguration { @Bean @ConditionalOnMissingBean(CamelContext.class) CamelContext camelContext(ApplicationContext applicationContext, - CamelConfigurationProperties configurationProperties) { + CamelConfigurationProperties config) { + CamelContext camelContext = new SpringCamelContext(applicationContext); SpringCamelContext.setNoStart(true); - if (!configurationProperties.isJmxEnabled()) { + if (!config.isJmxEnabled()) { camelContext.disableJMX(); } - if (configurationProperties.getName() != null) { - ((SpringCamelContext) camelContext).setName(configurationProperties.getName()); + if (config.getName() != null) { + ((SpringCamelContext) camelContext).setName(config.getName()); + } + + if (config.getLogDebugMaxChars() > 0) { + camelContext.getProperties().put(Exchange.LOG_DEBUG_BODY_MAX_CHARS, "" + config.getLogDebugMaxChars()); } return camelContext; @@ -67,9 +73,9 @@ public class CamelAutoConfiguration { @Bean @ConditionalOnMissingBean(RoutesCollector.class) - RoutesCollector routesCollector(ApplicationContext applicationContext, CamelConfigurationProperties configurationProperties) { + RoutesCollector routesCollector(ApplicationContext applicationContext, CamelConfigurationProperties config) { Collection<CamelContextConfiguration> configurations = applicationContext.getBeansOfType(CamelContextConfiguration.class).values(); - return new RoutesCollector(applicationContext, new ArrayList<CamelContextConfiguration>(configurations), configurationProperties); + return new RoutesCollector(applicationContext, new ArrayList<CamelContextConfiguration>(configurations), config); } /** @@ -79,8 +85,8 @@ public class CamelAutoConfiguration { // Camel handles the lifecycle of this bean @ConditionalOnMissingBean(ProducerTemplate.class) ProducerTemplate producerTemplate(CamelContext camelContext, - CamelConfigurationProperties configurationProperties) { - return camelContext.createProducerTemplate(configurationProperties.getProducerTemplateCacheSize()); + CamelConfigurationProperties config) { + return camelContext.createProducerTemplate(config.getProducerTemplateCacheSize()); } /** @@ -90,8 +96,8 @@ public class CamelAutoConfiguration { // Camel handles the lifecycle of this bean @ConditionalOnMissingBean(ConsumerTemplate.class) ConsumerTemplate consumerTemplate(CamelContext camelContext, - CamelConfigurationProperties configurationProperties) { - return camelContext.createConsumerTemplate(configurationProperties.getConsumerTemplateCacheSize()); + CamelConfigurationProperties config) { + return camelContext.createConsumerTemplate(config.getConsumerTemplateCacheSize()); } // SpringCamelContext integration http://git-wip-us.apache.org/repos/asf/camel/blob/fa8d7e31/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java ---------------------------------------------------------------------- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java index fe2f1fc..34aa4b3 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java @@ -50,13 +50,13 @@ public class CamelConfigurationProperties { /** * Directory to scan for adding additional XML routes. - * You can turn this off by setting the value to <tt>false</tt> + * You can turn this off by setting the value to false. */ private String xmlRoutes = "classpath:camel/*.xml"; /** * Directory to scan for adding additional XML rests. - * You can turn this off by setting the value to <tt>false</tt> + * You can turn this off by setting the value to false. */ private String xmlRests = "classpath:camel-rest/*.xml"; @@ -68,6 +68,13 @@ public class CamelConfigurationProperties { */ private boolean mainRunController; + /** + * Is used to limit the maximum length of the logging Camel message bodies. If the message body + * is longer than the limit, the log message is clipped. Use a value of 0 or negative to have unlimited length. + * Use for example 1000 to log at at most 1000 chars. + */ + private int logDebugMaxChars; + // Getters & setters public String getName() { @@ -133,4 +140,12 @@ public class CamelConfigurationProperties { public void setMainRunController(boolean mainRunController) { this.mainRunController = mainRunController; } + + public int getLogDebugMaxChars() { + return logDebugMaxChars; + } + + public void setLogDebugMaxChars(int logDebugMaxChars) { + this.logDebugMaxChars = logDebugMaxChars; + } }