[
https://issues.apache.org/jira/browse/CAMEL-12233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16359399#comment-16359399
]
ASF GitHub Bot commented on CAMEL-12233:
----------------------------------------
asfgit closed pull request #2217: CAMEL-12233: spring-boot: add
threadNamePattern property
URL: https://github.com/apache/camel/pull/2217
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
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 4757ab47590..ef71ac32545 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 @@ static CamelContext
doConfigureCamelContext(ApplicationContext applicationContex
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 9882a136670..4f3c5a0946e 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 @@
*/
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 boolean isUseMDCLogging() {
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 9a64e8c9d76..624dfba1351 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 @@
"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 void shouldLoadXmlRoutes() throws
InterruptedException {
xmlAutoLoadingMock.assertIsSatisfied();
}
+ @Test
+ public void shouldChangeThreadNamePattern() {
+
assertEquals(camelContext.getExecutorServiceManager().getThreadNamePattern(),
"customThreadName #counter#");
+ }
+
@Configuration
public static class TestConfig {
// Constants
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> spring-boot: add threadNamePattern property
> -------------------------------------------
>
> Key: CAMEL-12233
> URL: https://issues.apache.org/jira/browse/CAMEL-12233
> Project: Camel
> Issue Type: Improvement
> Components: camel-spring-boot
> Reporter: Pascal Schumacher
> Priority: Minor
> Fix For: 2.21.0
>
>
> In spring xml is is possible to configure the _threadNamePattern_ as an
> attribute of the _camelContext_ element.
> I could not find a way to configure with camel-spring-boot.
> It would be nice if _threadNamePattern_ was added to
> _CamelConfigurationProperties_.
> Thanks in advance!
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)