Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 29AB3180BF for ; Thu, 31 Mar 2016 10:09:34 +0000 (UTC) Received: (qmail 84704 invoked by uid 500); 31 Mar 2016 10:09:33 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 84599 invoked by uid 500); 31 Mar 2016 10:09:33 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 84502 invoked by uid 99); 31 Mar 2016 10:09:33 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Mar 2016 10:09:33 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7EE03DFC6E; Thu, 31 Mar 2016 10:09:33 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davsclaus@apache.org To: commits@camel.apache.org Date: Thu, 31 Mar 2016 10:09:37 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [5/5] camel git commit: CAMEL-9782: camel-spring-boot - Allow to configure options on CamelContext using auto config CAMEL-9782: camel-spring-boot - Allow to configure options on CamelContext using auto config Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/51a7cf2b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/51a7cf2b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/51a7cf2b Branch: refs/heads/camel-2.17.x Commit: 51a7cf2bdbae41fcb696cbd21f597ada6e857e3f Parents: 18df430 Author: Claus Ibsen Authored: Thu Mar 31 12:08:43 2016 +0200 Committer: Claus Ibsen Committed: Thu Mar 31 12:09:22 2016 +0200 ---------------------------------------------------------------------- .../spring/boot/CamelAutoConfiguration.java | 17 +- .../boot/CamelConfigurationProperties.java | 159 +++++++++++++++++++ 2 files changed, 174 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/51a7cf2b/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 f950e52..caedaf1 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 @@ -40,8 +40,7 @@ import org.springframework.context.annotation.Import; public class CamelAutoConfiguration { /** - * Spring-aware Camel context for the application. Auto-detects and loads all routes available in the Spring - * context. + * Spring-aware Camel context for the application. Auto-detects and loads all routes available in the Spring context. */ @Bean @ConditionalOnMissingBean(CamelContext.class) @@ -63,6 +62,20 @@ public class CamelAutoConfiguration { camelContext.getProperties().put(Exchange.LOG_DEBUG_BODY_MAX_CHARS, "" + config.getLogDebugMaxChars()); } + camelContext.setStreamCaching(config.isStreamCaching()); + camelContext.setTracing(config.isTracing()); + camelContext.setMessageHistory(config.isMessageHistory()); + camelContext.setHandleFault(config.isHandleFault()); + camelContext.setAutoStartup(config.isAutoStartup()); + camelContext.setAllowUseOriginalMessage(config.isAllowUseOriginalMessage()); + + if (camelContext.getManagementStrategy().getManagementAgent() != null) { + camelContext.getManagementStrategy().getManagementAgent().setEndpointRuntimeStatisticsEnabled(config.isEndpointRuntimeStatisticsEnabled()); + camelContext.getManagementStrategy().getManagementAgent().setStatisticsLevel(config.getJmxManagementStatisticsLevel()); + camelContext.getManagementStrategy().getManagementAgent().setManagementNamePattern(config.getJmxManagementNamePattern()); + camelContext.getManagementStrategy().getManagementAgent().setCreateConnector(config.isJmxCreateConnector()); + } + return camelContext; } http://git-wip-us.apache.org/repos/asf/camel/blob/51a7cf2b/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 34aa4b3..7b2968f 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 @@ -16,6 +16,7 @@ */ package org.apache.camel.spring.boot; +import org.apache.camel.ManagementStatisticsLevel; import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "camel.springboot") @@ -75,6 +76,84 @@ public class CamelConfigurationProperties { */ private int logDebugMaxChars; + /** + * Sets whether stream caching is enabled or not. + * + * Default is false. + */ + private boolean streamCaching; + + /** + * Sets whether tracing is enabled or not. + * + * Default is false. + */ + private boolean tracing; + + /** + * Sets whether message history is enabled or not. + * + * Default is true. + */ + private boolean messageHistory = true; + + /** + * Sets whether fault handling is enabled or not. + * + * Default is false. + */ + private boolean handleFault; + + /** + * Sets whether the object should automatically start when Camel starts. + * Important: Currently only routes can be disabled, as CamelContext's are always started. + * Note: When setting auto startup false on CamelContext then that takes precedence + * and no routes is started. You would need to start CamelContext explicit using + * the org.apache.camel.CamelContext.start() method, to start the context, and then + * you would need to start the routes manually using CamelContext.startRoute(String). + * + * Default is true to always start up. + */ + private boolean autoStartup = true; + + /** + * Sets whether to allow access to the original message from Camel's error handler, + * or from org.apache.camel.spi.UnitOfWork.getOriginalInMessage(). + * Turning this off can optimize performance, as defensive copy of the original message is not needed. + * + * Default is true. + */ + private boolean allowUseOriginalMessage = true; + + /** + * Sets whether endpoint runtime statistics is enabled (gathers runtime usage of each incoming and outgoing endpoints). + * + * The default value is true. + */ + private boolean endpointRuntimeStatisticsEnabled = true; + + /** + * Sets the JMX statistics level + * The level can be set to Extended to gather additional information + * + * The default value is Default. + */ + private ManagementStatisticsLevel jmxManagementStatisticsLevel = ManagementStatisticsLevel.Default; + + /** + * The naming pattern for creating the CamelContext JMX management name. + * + * The default pattern is #name# + */ + private String jmxManagementNamePattern = "#name#"; + + /** + * Whether JMX connector is created, allowing clients to connect remotely + * + * The default value is false. + */ + private boolean jmxCreateConnector; + // Getters & setters public String getName() { @@ -148,4 +227,84 @@ public class CamelConfigurationProperties { public void setLogDebugMaxChars(int logDebugMaxChars) { this.logDebugMaxChars = logDebugMaxChars; } + + public boolean isStreamCaching() { + return streamCaching; + } + + public void setStreamCaching(boolean streamCaching) { + this.streamCaching = streamCaching; + } + + public boolean isTracing() { + return tracing; + } + + public void setTracing(boolean tracing) { + this.tracing = tracing; + } + + public boolean isMessageHistory() { + return messageHistory; + } + + public void setMessageHistory(boolean messageHistory) { + this.messageHistory = messageHistory; + } + + public boolean isHandleFault() { + return handleFault; + } + + public void setHandleFault(boolean handleFault) { + this.handleFault = handleFault; + } + + public boolean isAutoStartup() { + return autoStartup; + } + + public void setAutoStartup(boolean autoStartup) { + this.autoStartup = autoStartup; + } + + public boolean isAllowUseOriginalMessage() { + return allowUseOriginalMessage; + } + + public void setAllowUseOriginalMessage(boolean allowUseOriginalMessage) { + this.allowUseOriginalMessage = allowUseOriginalMessage; + } + + public boolean isEndpointRuntimeStatisticsEnabled() { + return endpointRuntimeStatisticsEnabled; + } + + public void setEndpointRuntimeStatisticsEnabled(boolean endpointRuntimeStatisticsEnabled) { + this.endpointRuntimeStatisticsEnabled = endpointRuntimeStatisticsEnabled; + } + + public ManagementStatisticsLevel getJmxManagementStatisticsLevel() { + return jmxManagementStatisticsLevel; + } + + public void setJmxManagementStatisticsLevel(ManagementStatisticsLevel jmxManagementStatisticsLevel) { + this.jmxManagementStatisticsLevel = jmxManagementStatisticsLevel; + } + + public String getJmxManagementNamePattern() { + return jmxManagementNamePattern; + } + + public void setJmxManagementNamePattern(String jmxManagementNamePattern) { + this.jmxManagementNamePattern = jmxManagementNamePattern; + } + + public boolean isJmxCreateConnector() { + return jmxCreateConnector; + } + + public void setJmxCreateConnector(boolean jmxCreateConnector) { + this.jmxCreateConnector = jmxCreateConnector; + } }