Skip to content

Commit

Permalink
Create a camel-componentdsl extension #1376
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli committed Jun 22, 2020
1 parent 9a138c7 commit a371be1
Show file tree
Hide file tree
Showing 13 changed files with 313 additions and 12 deletions.
22 changes: 22 additions & 0 deletions docs/modules/ROOT/pages/extensions/componentdsl.adoc
Original file line number Diff line number Diff line change
@@ -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 component 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.
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,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"]
|===
Expand All @@ -441,6 +441,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
Expand Down
73 changes: 73 additions & 0 deletions extensions/componentdsl/deployment/pom.xml
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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.
*/
package org.apache.camel.quarkus.componentdsl.deployment;

import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;

class ComponentDSLProcessor {
private static final String FEATURE = "camel-componentdsl";

@BuildStep
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}
}
37 changes: 37 additions & 0 deletions extensions/componentdsl/pom.xml
Original file line number Diff line number Diff line change
@@ -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>
92 changes: 92 additions & 0 deletions extensions/componentdsl/runtime/pom.xml
Original file line number Diff line number Diff line change
@@ -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-M3</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>
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<module>bindy</module>
<module>box</module>
<module>braintree</module>
<module>componentdsl</module>
<module>consul</module>
<module>controlbus</module>
<module>couchdb</module>
Expand Down
4 changes: 4 additions & 0 deletions integration-tests/main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-endpointdsl</artifactId>
</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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
5 changes: 5 additions & 0 deletions poms/bom-deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@
<artifactId>camel-quarkus-cassandraql-deployment</artifactId>
<version>${camel-quarkus.version}</version>
</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>
Expand Down
5 changes: 5 additions & 0 deletions poms/bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,11 @@
<artifactId>camel-quarkus-cassandraql</artifactId>
<version>${camel-quarkus.version}</version>
</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>
Expand Down

0 comments on commit a371be1

Please sign in to comment.