This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
commit 18083f631a9dda1599b2c6315e16d4aeccf808ab Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Wed Aug 5 07:17:13 2020 +0200 Revert "Regen camel-opentracing starter" This reverts commit acbdd17f997b7b70a9877ca7de2ce09153866168. --- .../camel-opentracing-starter/pom.xml | 4 +- .../src/main/docs/opentracing-starter.adoc | 31 ++++++++++++ .../opentracing/starter/CamelOpenTracing.java | 34 +++++++++++++ .../starter/OpenTracingAutoConfiguration.java | 57 ++++++++++++++++++++++ .../OpenTracingConditionalAutoConfiguration.java | 31 ++++++++++++ .../OpenTracingConfigurationProperties.java | 52 ++++++++++++++++++++ .../src/main/resources/META-INF/spring.factories | 18 +++++++ components-starter/pom.xml | 2 +- tooling/camel-spring-boot-dependencies/pom.xml | 10 ---- 9 files changed, 226 insertions(+), 13 deletions(-) diff --git a/components-starter/camel-opentracing-starter/pom.xml b/components-starter/camel-opentracing-starter/pom.xml index 06be567..3979b26 100644 --- a/components-starter/camel-opentracing-starter/pom.xml +++ b/components-starter/camel-opentracing-starter/pom.xml @@ -26,8 +26,8 @@ </parent> <artifactId>camel-opentracing-starter</artifactId> <packaging>jar</packaging> - <!-- <name>Camel Spring Boot :: Starters :: Dozer</name>--> - <!-- <description>Spring-Boot Starter for Camel Support for the Dozer type conversion framework</description>--> + <name>Camel SB Starters :: OpenTracing</name> + <description>Spring-Boot Starter for Distributed message tracing using OpenTracing</description> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> diff --git a/components-starter/camel-opentracing-starter/src/main/docs/opentracing-starter.adoc b/components-starter/camel-opentracing-starter/src/main/docs/opentracing-starter.adoc new file mode 100644 index 0000000..8273355 --- /dev/null +++ b/components-starter/camel-opentracing-starter/src/main/docs/opentracing-starter.adoc @@ -0,0 +1,31 @@ +// spring-boot-auto-configure options: START +:page-partial: +:doctitle: Camel Spring Boot Starter for opentracing + +== Spring Boot Auto-Configuration + +When using opentracing with Spring Boot make sure to use the following Maven dependency to have support for auto configuration: + +[source,xml] +---- +<dependency> + <groupId>org.apache.camel.springboot</groupId> + <artifactId>camel-opentracing-starter</artifactId> + <version>x.x.x</version> + <!-- use the same version as your Camel core version --> +</dependency> +---- + + +The component supports 2 options, which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *camel.opentracing.encoding* | Activate or deactivate dash encoding in headers (required by JMS) for messaging | | Boolean +| *camel.opentracing.exclude-patterns* | Sets exclude pattern(s) that will disable tracing for Camel messages that matches the pattern. | | Set +|=== + +// spring-boot-auto-configure options: END diff --git a/components-starter/camel-opentracing-starter/src/main/java/org/apache/camel/opentracing/starter/CamelOpenTracing.java b/components-starter/camel-opentracing-starter/src/main/java/org/apache/camel/opentracing/starter/CamelOpenTracing.java new file mode 100644 index 0000000..079c5a1 --- /dev/null +++ b/components-starter/camel-opentracing-starter/src/main/java/org/apache/camel/opentracing/starter/CamelOpenTracing.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.opentracing.starter; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.springframework.context.annotation.Import; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Inherited +@Import(OpenTracingAutoConfiguration.class) +public @interface CamelOpenTracing { +} diff --git a/components-starter/camel-opentracing-starter/src/main/java/org/apache/camel/opentracing/starter/OpenTracingAutoConfiguration.java b/components-starter/camel-opentracing-starter/src/main/java/org/apache/camel/opentracing/starter/OpenTracingAutoConfiguration.java new file mode 100644 index 0000000..9069f62 --- /dev/null +++ b/components-starter/camel-opentracing-starter/src/main/java/org/apache/camel/opentracing/starter/OpenTracingAutoConfiguration.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.opentracing.starter; + +import io.opentracing.Tracer; +import org.apache.camel.CamelContext; +import org.apache.camel.opentracing.OpenTracingTracer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration(proxyBeanMethods = false) +@EnableConfigurationProperties(OpenTracingConfigurationProperties.class) +@ConditionalOnProperty(value = "camel.opentracing.enabled", matchIfMissing = true) +public class OpenTracingAutoConfiguration { + + @Autowired(required = false) + private Tracer tracer; + + @Bean(initMethod = "", destroyMethod = "") + // Camel handles the lifecycle of this bean + @ConditionalOnMissingBean(OpenTracingTracer.class) + OpenTracingTracer openTracingEventNotifier(CamelContext camelContext, + OpenTracingConfigurationProperties config) { + OpenTracingTracer ottracer = new OpenTracingTracer(); + if (tracer != null) { + ottracer.setTracer(tracer); + } + if (config.getExcludePatterns() != null) { + ottracer.setExcludePatterns(config.getExcludePatterns()); + } + if (config.getEncoding() != null) { + ottracer.setEncoding(config.getEncoding().booleanValue()); + } + ottracer.init(camelContext); + + return ottracer; + } + +} diff --git a/components-starter/camel-opentracing-starter/src/main/java/org/apache/camel/opentracing/starter/OpenTracingConditionalAutoConfiguration.java b/components-starter/camel-opentracing-starter/src/main/java/org/apache/camel/opentracing/starter/OpenTracingConditionalAutoConfiguration.java new file mode 100644 index 0000000..24183a5 --- /dev/null +++ b/components-starter/camel-opentracing-starter/src/main/java/org/apache/camel/opentracing/starter/OpenTracingConditionalAutoConfiguration.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.opentracing.starter; + +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +/** + * A configuration controller to enable OpenTracing via the configuration property. + * Useful to bootstrap OpenTracing when not using the {@link CamelOpenTracing} annotation. + */ +@Configuration(proxyBeanMethods = false) +@ConditionalOnProperty(value = "camel.opentracing.enabled") +@Import(OpenTracingAutoConfiguration.class) +public class OpenTracingConditionalAutoConfiguration { +} diff --git a/components-starter/camel-opentracing-starter/src/main/java/org/apache/camel/opentracing/starter/OpenTracingConfigurationProperties.java b/components-starter/camel-opentracing-starter/src/main/java/org/apache/camel/opentracing/starter/OpenTracingConfigurationProperties.java new file mode 100644 index 0000000..4cdd7f7 --- /dev/null +++ b/components-starter/camel-opentracing-starter/src/main/java/org/apache/camel/opentracing/starter/OpenTracingConfigurationProperties.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.opentracing.starter; + +import java.util.Set; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties(prefix = "camel.opentracing") +public class OpenTracingConfigurationProperties { + + /** + * Sets exclude pattern(s) that will disable tracing for Camel messages that + * matches the pattern. + */ + private Set<String> excludePatterns; + /** + * Activate or deactivate dash encoding in headers (required by JMS) for + * messaging + */ + private Boolean encoding; + + public Set<String> getExcludePatterns() { + return excludePatterns; + } + + public void setExcludePatterns(Set<String> excludePatterns) { + this.excludePatterns = excludePatterns; + } + + public Boolean getEncoding() { + return encoding; + } + + public void setEncoding(Boolean encoding) { + this.encoding = encoding; + } +} diff --git a/components-starter/camel-opentracing-starter/src/main/resources/META-INF/spring.factories b/components-starter/camel-opentracing-starter/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..9294dbb --- /dev/null +++ b/components-starter/camel-opentracing-starter/src/main/resources/META-INF/spring.factories @@ -0,0 +1,18 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +org.apache.camel.opentracing.starter.OpenTracingConditionalAutoConfiguration \ No newline at end of file diff --git a/components-starter/pom.xml b/components-starter/pom.xml index 9529c33..2b1e66e 100644 --- a/components-starter/pom.xml +++ b/components-starter/pom.xml @@ -413,8 +413,8 @@ <module>camel-univocity-parsers-starter</module> <module>camel-validator-starter</module> <module>camel-velocity-starter</module> - <module>camel-vertx-http-starter</module> <module>camel-vertx-starter</module> + <module>camel-vertx-http-starter</module> <module>camel-vertx-websocket-starter</module> <module>camel-vm-starter</module> <module>camel-weather-starter</module> diff --git a/tooling/camel-spring-boot-dependencies/pom.xml b/tooling/camel-spring-boot-dependencies/pom.xml index 9ac2079..0b5bb4e 100644 --- a/tooling/camel-spring-boot-dependencies/pom.xml +++ b/tooling/camel-spring-boot-dependencies/pom.xml @@ -3219,11 +3219,6 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-opentelemetry</artifactId> - <version>3.5.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> <artifactId>camel-opentracing</artifactId> <version>3.5.0-SNAPSHOT</version> </dependency> @@ -3694,11 +3689,6 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-tracing</artifactId> - <version>3.5.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> <artifactId>camel-twilio</artifactId> <version>3.5.0-SNAPSHOT</version> </dependency>