This is an automated email from the ASF dual-hosted git repository.

pascalschumacher 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 5ffd14a  CAMEL-12233: spring-boot: add threadNamePattern property 
(closes #2217)
5ffd14a is described below

commit 5ffd14a35dbf0d25f30f0822a03c539f95e6734b
Author: Pascal Schumacher <pascalschumac...@gmx.net>
AuthorDate: Fri Feb 9 17:45:30 2018 +0100

    CAMEL-12233: spring-boot: add threadNamePattern property (closes #2217)
---
 .../camel/spring/boot/CamelAutoConfiguration.java    |  4 ++++
 .../spring/boot/CamelConfigurationProperties.java    | 20 ++++++++++++++++++++
 .../spring/boot/CamelAutoConfigurationTest.java      |  8 +++++++-
 3 files changed, 31 insertions(+), 1 deletion(-)

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 4757ab4..ef71ac3 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
@@ -227,6 +227,10 @@ public class CamelAutoConfiguration {
             camelContext.setReloadStrategy(reload);
         }
 
+        if (config.getThreadNamePattern() != null) {
+            
camelContext.getExecutorServiceManager().setThreadNamePattern(config.getThreadNamePattern());
+        }
+
         // additional advanced configuration which is not configured using 
CamelConfigurationProperties
         afterPropertiesSet(applicationContext, camelContext);
 
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 9882a13..4f3c5a0 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
@@ -449,6 +449,18 @@ public class CamelConfigurationProperties {
      */
     private boolean useMDCLogging;
 
+    /**
+     * Sets the thread name pattern used for creating the full thread name.
+     * <p/>
+     * The default pattern is: <tt>Camel (#camelId#) thread ##counter# - 
#name#</tt>
+     * <p/>
+     * Where <tt>#camelId#</tt> is the name of the {@link 
org.apache.camel.CamelContext}
+     * <br/>and <tt>#counter#</tt> is a unique incrementing counter.
+     * <br/>and <tt>#name#</tt> is the regular thread name.
+     * <br/>You can also use <tt>#longName#</tt> is the long thread name which 
can includes endpoint parameters etc.
+     */
+    private String threadNamePattern;
+
     // Getters & setters
 
     public String getName() {
@@ -948,4 +960,12 @@ public class CamelConfigurationProperties {
     public void setUseMDCLogging(boolean useMDCLogging) {
         this.useMDCLogging = useMDCLogging;
     }
+
+    public String getThreadNamePattern() {
+        return threadNamePattern;
+    }
+
+    public void setThreadNamePattern(String threadNamePattern) {
+        this.threadNamePattern = threadNamePattern;
+    }
 }
diff --git 
a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationTest.java
 
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationTest.java
index 9a64e8c..624dfba 100644
--- 
a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationTest.java
+++ 
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationTest.java
@@ -50,7 +50,8 @@ import static org.mockito.Mockito.verify;
         "camel.springboot.consumerTemplateCacheSize=100",
         "camel.springboot.jmxEnabled=true",
         "camel.springboot.name=customName",
-        "camel.springboot.typeConversion=true"}
+        "camel.springboot.typeConversion=true",
+        "camel.springboot.threadNamePattern=customThreadName #counter#"}
 )
 public class CamelAutoConfigurationTest extends Assert {
 
@@ -171,6 +172,11 @@ public class CamelAutoConfigurationTest extends Assert {
         xmlAutoLoadingMock.assertIsSatisfied();
     }
 
+    @Test
+    public void shouldChangeThreadNamePattern() {
+        
assertEquals(camelContext.getExecutorServiceManager().getThreadNamePattern(), 
"customThreadName #counter#");
+    }
+
     @Configuration
     public static class TestConfig {
         // Constants

-- 
To stop receiving notification emails like this one, please contact
pascalschumac...@apache.org.

Reply via email to