You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/03/30 14:58:53 UTC

[1/3] camel git commit: CAMEL-9775: Cleanup the spring-boot auto config doc

Repository: camel
Updated Branches:
  refs/heads/camel-2.17.x 6f05f0ff2 -> fa8d7e314
  refs/heads/master 20c5db549 -> f701c37fe


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/3a42303d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3a42303d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3a42303d

Branch: refs/heads/master
Commit: 3a42303d612d314236d915cb97b5bea4f57f8090
Parents: 20c5db5
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Mar 30 14:56:29 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 30 14:56:29 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/3a42303d/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/3a42303d/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;
+    }
 }


[2/3] camel git commit: Polished

Posted by da...@apache.org.
Polished


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f701c37f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f701c37f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f701c37f

Branch: refs/heads/master
Commit: f701c37fe220de0197af5f37b7f336455856ea21
Parents: 3a42303
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Mar 30 14:58:17 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 30 14:58:17 2016 +0200

----------------------------------------------------------------------
 .../starter/ZipkinConfigurationProperties.java  | 62 +++++++++++---------
 1 file changed, 34 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f701c37f/components/camel-zipkin-starter/src/main/java/org/apache/camel/zipkin/starter/ZipkinConfigurationProperties.java
----------------------------------------------------------------------
diff --git a/components/camel-zipkin-starter/src/main/java/org/apache/camel/zipkin/starter/ZipkinConfigurationProperties.java b/components/camel-zipkin-starter/src/main/java/org/apache/camel/zipkin/starter/ZipkinConfigurationProperties.java
index ffd338b..18b95e8 100644
--- a/components/camel-zipkin-starter/src/main/java/org/apache/camel/zipkin/starter/ZipkinConfigurationProperties.java
+++ b/components/camel-zipkin-starter/src/main/java/org/apache/camel/zipkin/starter/ZipkinConfigurationProperties.java
@@ -24,21 +24,52 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
 @ConfigurationProperties(prefix = "camel.zipkin")
 public class ZipkinConfigurationProperties {
 
+    /**
+     * Sets a hostname for the remote zipkin server to use.
+     */
     private String hostName;
+
+    /**
+     * Sets the port number for the remote zipkin server to use.
+     */
     private int port;
+
+    /**
+     * Configures a rate that decides how many events should be traced by zipkin.
+     * The rate is expressed as a percentage (1.0f = 100%, 0.5f is 50%, 0.1f is 10%).
+     */
     private float rate = 1.0f;
+
+    /**
+     * Whether to include the Camel message body in the zipkin traces.
+     *
+     * This is not recommended for production usage, or when having big payloads.
+     * You can limit the size by configuring camel.springboot.log-debug-max-chars option.
+     */
     private boolean includeMessageBody;
+
+    /**
+     * To use a global service name that matches all Camel events
+     */
     private String serviceName;
+
+    /**
+     * Sets exclude pattern(s) that will disable tracing with zipkin for Camel messages that matches the pattern.
+     */
     private Set<String> excludePatterns;
+
+    /**
+     * Sets service mapping(s) that matches Camel events to the given zipkin service name.
+     * The key is the pattern, the value is the service name.
+     */
     private Map<String, String> serviceMappings;
 
+    // Getters & setters
+
     public String getHostName() {
         return hostName;
     }
 
-    /**
-     * Sets a hostname for the remote zipkin server to use.
-     */
     public void setHostName(String hostName) {
         this.hostName = hostName;
     }
@@ -47,9 +78,6 @@ public class ZipkinConfigurationProperties {
         return port;
     }
 
-    /**
-     * Sets the port number for the remote zipkin server to use.
-     */
     public void setPort(int port) {
         this.port = port;
     }
@@ -58,12 +86,6 @@ public class ZipkinConfigurationProperties {
         return rate;
     }
 
-    /**
-     * Configures a rate that decides how many events should be traced by zipkin.
-     * The rate is expressed as a percentage (1.0f = 100%, 0.5f is 50%, 0.1f is 10%).
-     *
-     * @param rate minimum sample rate is 0.0001, or 0.01% of traces
-     */
     public void setRate(float rate) {
         this.rate = rate;
     }
@@ -72,12 +94,6 @@ public class ZipkinConfigurationProperties {
         return includeMessageBody;
     }
 
-    /**
-     * Whether to include the Camel message body in the zipkin traces.
-     * <p/>
-     * This is not recommended for production usage, or when having big payloads. You can limit the size by
-     * configuring the <a href="http://camel.apache.org/how-do-i-set-the-max-chars-when-debug-logging-messages-in-camel.html">max debug log size</a>.
-     */
     public void setIncludeMessageBody(boolean includeMessageBody) {
         this.includeMessageBody = includeMessageBody;
     }
@@ -86,9 +102,6 @@ public class ZipkinConfigurationProperties {
         return serviceName;
     }
 
-    /**
-     * To use a global service name that matches all Camel events
-     */
     public void setServiceName(String serviceName) {
         this.serviceName = serviceName;
     }
@@ -97,9 +110,6 @@ public class ZipkinConfigurationProperties {
         return excludePatterns;
     }
 
-    /**
-     * Sets exclude pattern(s) that will disable tracing with zipkin for Camel messages that matches the pattern.
-     */
     public void setExcludePatterns(Set<String> excludePatterns) {
         this.excludePatterns = excludePatterns;
     }
@@ -108,10 +118,6 @@ public class ZipkinConfigurationProperties {
         return serviceMappings;
     }
 
-    /**
-     * Sets service mapping(s) that matches Camel events to the given zipkin service name.
-     * The key is the pattern, the value is the service name.
-     */
     public void setServiceMappings(Map<String, String> serviceMappings) {
         this.serviceMappings = serviceMappings;
     }


[3/3] camel git commit: CAMEL-9775: Cleanup the spring-boot auto config doc

Posted by da...@apache.org.
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 <da...@apache.org>
Authored: Wed Mar 30 14:56:29 2016 +0200
Committer: Claus Ibsen <da...@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;
+    }
 }