This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push: new a939106 Create a camel-componentdsl extension #1376 a939106 is described below commit a9391060fdca728079f34cc700df02b63a68876c Author: lburgazzoli <lburgazz...@gmail.com> AuthorDate: Mon Jun 22 22:12:12 2020 +0200 Create a camel-componentdsl extension #1376 --- .../ROOT/pages/extensions/componentdsl.adoc | 22 ++++++ .../pages/list-of-camel-quarkus-extensions.adoc | 4 +- extensions/componentdsl/deployment/pom.xml | 73 +++++++++++++++++ .../deployment/ComponentDSLProcessor.java | 16 ++-- extensions/componentdsl/pom.xml | 37 +++++++++ extensions/componentdsl/runtime/pom.xml | 92 ++++++++++++++++++++++ .../main/resources/META-INF/quarkus-extension.yaml | 29 +++++++ extensions/pom.xml | 1 + integration-tests/main/pom.xml | 4 + .../apache/camel/quarkus/main/CamelComponents.java | 15 ++-- .../quarkus/main/CamelRouteWithEndpointDSL.java | 9 ++- poms/bom-deployment/pom.xml | 5 ++ poms/bom/pom.xml | 5 ++ 13 files changed, 292 insertions(+), 20 deletions(-) diff --git a/docs/modules/ROOT/pages/extensions/componentdsl.adoc b/docs/modules/ROOT/pages/extensions/componentdsl.adoc new file mode 100644 index 0000000..47f2264 --- /dev/null +++ b/docs/modules/ROOT/pages/extensions/componentdsl.adoc @@ -0,0 +1,22 @@ +// Do not edit directly! +// This file was generated by camel-quarkus-package-maven-plugin:update-extension-doc-page + +[[componentdsl]] += Component DSL + +[.badges] +[.badge-key]##Since Camel Quarkus##[.badge-version]##1.0.0-M3## [.badge-key]##JVM##[.badge-supported]##supported## [.badge-key]##Native##[.badge-supported]##supported## + +Create Camel components with a fluent Java DSL + +== Maven coordinates + +[source,xml] +---- +<dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-componentdsl</artifactId> +</dependency> +---- + +Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications. diff --git a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc index bbfd973..4f70644 100644 --- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc +++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc @@ -433,7 +433,7 @@ Number of Camel languages: 13 in 7 JAR artifacts (0 deprecated) == Miscellaneous Extensions // others: START -Number of miscellaneous extensions: 15 in 15 JAR artifacts (1 deprecated) +Number of miscellaneous extensions: 16 in 16 JAR artifacts (1 deprecated) [width="100%",cols="4,1,1,1,5",options="header"] |=== @@ -445,6 +445,8 @@ Number of miscellaneous extensions: 15 in 15 JAR artifacts (1 deprecated) | xref:extensions/core-cloud.adoc[Cloud] | camel-quarkus-core-cloud | Native + Stable | 0.2.0 | The Camel Quarkus core cloud module +| xref:extensions/componentdsl.adoc[Component DSL] | camel-quarkus-componentdsl | Native + Stable | 1.0.0-M3 | Create Camel components with a fluent Java DSL + | xref:extensions/endpointdsl.adoc[Endpoint DSL] | camel-quarkus-endpointdsl | Native + Stable | 1.0.0-M3 | Code Camel endpoint URI using Java DSL instead of plain strings | xref:extensions/hystrix.adoc[Hystrix] | camel-quarkus-hystrix | Native + Stable | 1.0.0-M1 | *deprecated* Circuit Breaker EIP using Netflix Hystrix diff --git a/extensions/componentdsl/deployment/pom.xml b/extensions/componentdsl/deployment/pom.xml new file mode 100644 index 0000000..7eb3cda --- /dev/null +++ b/extensions/componentdsl/deployment/pom.xml @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-componentdsl-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-componentdsl-deployment</artifactId> + <name>Camel Quarkus :: Component DSL :: Deployment</name> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-bom-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core-deployment</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-componentdsl</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-processor</artifactId> + <version>${quarkus.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/integration-tests/main/src/main/java/org/apache/camel/quarkus/main/CamelRouteWithEndpointDSL.java b/extensions/componentdsl/deployment/src/main/java/org/apache/camel/quarkus/componentdsl/deployment/ComponentDSLProcessor.java similarity index 69% copy from integration-tests/main/src/main/java/org/apache/camel/quarkus/main/CamelRouteWithEndpointDSL.java copy to extensions/componentdsl/deployment/src/main/java/org/apache/camel/quarkus/componentdsl/deployment/ComponentDSLProcessor.java index cf40e2e..a9410d7 100644 --- a/integration-tests/main/src/main/java/org/apache/camel/quarkus/main/CamelRouteWithEndpointDSL.java +++ b/extensions/componentdsl/deployment/src/main/java/org/apache/camel/quarkus/componentdsl/deployment/ComponentDSLProcessor.java @@ -14,16 +14,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.quarkus.main; +package org.apache.camel.quarkus.componentdsl.deployment; -import org.apache.camel.builder.endpoint.EndpointRouteBuilder; +import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.builditem.FeatureBuildItem; -public class CamelRouteWithEndpointDSL extends EndpointRouteBuilder { +class ComponentDSLProcessor { + private static final String FEATURE = "camel-componentdsl"; - @Override - public void configure() { - from(direct("endpointdsl")) - .id("endpointdsl") - .to("log:keep-alive"); + @BuildStep + FeatureBuildItem feature() { + return new FeatureBuildItem(FEATURE); } } diff --git a/extensions/componentdsl/pom.xml b/extensions/componentdsl/pom.xml new file mode 100644 index 0000000..baa7f06 --- /dev/null +++ b/extensions/componentdsl/pom.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-build-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../../poms/build-parent/pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-componentdsl-parent</artifactId> + <name>Camel Quarkus :: Component DSL</name> + <packaging>pom</packaging> + + <modules> + <module>deployment</module> + <module>runtime</module> + </modules> +</project> diff --git a/extensions/componentdsl/runtime/pom.xml b/extensions/componentdsl/runtime/pom.xml new file mode 100644 index 0000000..99e61c0 --- /dev/null +++ b/extensions/componentdsl/runtime/pom.xml @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-componentdsl-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-componentdsl</artifactId> + <name>Camel Quarkus :: Component DSL :: Runtime</name> + <description>Create Camel components with a fluent Java DSL</description> + + <properties> + <firstVersion>1.0.0-CR3</firstVersion> + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-bom</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-componentdsl</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-package-maven-plugin</artifactId> + <executions> + <execution> + <id>update-extension-doc-page</id> + <goals><goal>update-extension-doc-page</goal></goals> + <phase>process-classes</phase> + </execution> + </executions> + </plugin> + <plugin> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-bootstrap-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-processor</artifactId> + <version>${quarkus.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/extensions/componentdsl/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/componentdsl/runtime/src/main/resources/META-INF/quarkus-extension.yaml new file mode 100644 index 0000000..97276d9 --- /dev/null +++ b/extensions/componentdsl/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -0,0 +1,29 @@ +# +# 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. +# + +# This is a generated file. Do not edit directly! +# To re-generate, run the following command from the top level directory: +# +# mvn -N cq:update-quarkus-metadata +# +--- +name: "Camel Component DSL" +description: "Create Camel components with a fluent Java DSL" +metadata: + guide: "https://camel.apache.org/camel-quarkus/latest/extensions/componentdsl.html" + categories: + - "integration" diff --git a/extensions/pom.xml b/extensions/pom.xml index 5e1faec..e14064d 100644 --- a/extensions/pom.xml +++ b/extensions/pom.xml @@ -74,6 +74,7 @@ <module>bindy</module> <module>box</module> <module>braintree</module> + <module>componentdsl</module> <module>consul</module> <module>controlbus</module> <module>couchdb</module> diff --git a/integration-tests/main/pom.xml b/integration-tests/main/pom.xml index ec0645a..4e1189f 100644 --- a/integration-tests/main/pom.xml +++ b/integration-tests/main/pom.xml @@ -50,6 +50,10 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-componentdsl</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-reactive-executor</artifactId> </dependency> <dependency> diff --git a/integration-tests/main/src/main/java/org/apache/camel/quarkus/main/CamelComponents.java b/integration-tests/main/src/main/java/org/apache/camel/quarkus/main/CamelComponents.java index 556ab90..2d9a91a 100644 --- a/integration-tests/main/src/main/java/org/apache/camel/quarkus/main/CamelComponents.java +++ b/integration-tests/main/src/main/java/org/apache/camel/quarkus/main/CamelComponents.java @@ -16,21 +16,18 @@ */ package org.apache.camel.quarkus.main; -import javax.enterprise.inject.Produces; +import javax.enterprise.context.ApplicationScoped; import javax.inject.Named; import javax.inject.Singleton; +import org.apache.camel.builder.component.ComponentsBuilderFactory; import org.apache.camel.component.direct.DirectComponent; -@Singleton +@ApplicationScoped public class CamelComponents { @Singleton - @Named("direct") - @Produces - DirectComponent directComponent() { - DirectComponent component = new DirectComponent(); - component.setTimeout(1234); - - return component; + @Named + DirectComponent direct() { + return ComponentsBuilderFactory.direct().timeout(1234).build(); } } diff --git a/integration-tests/main/src/main/java/org/apache/camel/quarkus/main/CamelRouteWithEndpointDSL.java b/integration-tests/main/src/main/java/org/apache/camel/quarkus/main/CamelRouteWithEndpointDSL.java index cf40e2e..2ccec43 100644 --- a/integration-tests/main/src/main/java/org/apache/camel/quarkus/main/CamelRouteWithEndpointDSL.java +++ b/integration-tests/main/src/main/java/org/apache/camel/quarkus/main/CamelRouteWithEndpointDSL.java @@ -16,14 +16,19 @@ */ package org.apache.camel.quarkus.main; +import org.apache.camel.builder.EndpointConsumerBuilder; +import org.apache.camel.builder.EndpointProducerBuilder; import org.apache.camel.builder.endpoint.EndpointRouteBuilder; public class CamelRouteWithEndpointDSL extends EndpointRouteBuilder { @Override public void configure() { - from(direct("endpointdsl")) + EndpointConsumerBuilder consumer = direct("endpointdsl"); + EndpointProducerBuilder producer = log("keep-alive").showAll(true); + + from(consumer) .id("endpointdsl") - .to("log:keep-alive"); + .to(producer); } } diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml index 284e580..731f1e8 100644 --- a/poms/bom-deployment/pom.xml +++ b/poms/bom-deployment/pom.xml @@ -289,6 +289,11 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-componentdsl-deployment</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-consul-deployment</artifactId> <version>${camel-quarkus.version}</version> </dependency> diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml index 341e872..b38a15b 100644 --- a/poms/bom/pom.xml +++ b/poms/bom/pom.xml @@ -1426,6 +1426,11 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-componentdsl</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-consul</artifactId> <version>${camel-quarkus.version}</version> </dependency>