You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/08/10 07:43:37 UTC

[camel-quarkus] branch master updated: create extension for camel's core cloud impl

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-quarkus.git


The following commit(s) were added to refs/heads/master by this push:
     new fbec7aa  create extension for camel's core cloud impl
     new 0edeb20  Merge pull request #121 from lburgazzoli/camel-cloud-impl-ext
fbec7aa is described below

commit fbec7aaf4521642be03988477165826174556a7c
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Fri Aug 9 16:20:29 2019 +0200

    create extension for camel's core cloud impl
---
 bom/pom.xml                                        |  10 ++
 extensions/core-cloud/deployment/pom.xml           |  43 ++++++++
 extensions/core-cloud/pom.xml                      |  19 ++++
 extensions/core-cloud/runtime/pom.xml              |  57 +++++++++++
 ...e_camel_impl_cloud_CachingServiceDiscovery.java |  55 ++++++++++
 extensions/pom.xml                                 |   1 +
 integration-tests/core-impl/pom.xml                | 114 +++++++++++++++++++++
 .../src/main/resources/application.properties      |  33 ++++++
 integration-tests/pom.xml                          |   2 +
 9 files changed, 334 insertions(+)

diff --git a/bom/pom.xml b/bom/pom.xml
index 113614d..707fe57 100644
--- a/bom/pom.xml
+++ b/bom/pom.xml
@@ -88,6 +88,11 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.camel</groupId>
+                <artifactId>camel-cloud</artifactId>
+                <version>${camel.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.camel</groupId>
                 <artifactId>camel-core-engine</artifactId>
                 <version>${camel.version}</version>
             </dependency>
@@ -254,6 +259,11 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-core-cloud</artifactId>
+                <version>${camel-quarkus.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
                 <artifactId>camel-quarkus-aws-s3</artifactId>
                 <version>${camel-quarkus.version}</version>
             </dependency>
diff --git a/extensions/core-cloud/deployment/pom.xml b/extensions/core-cloud/deployment/pom.xml
new file mode 100644
index 0000000..c88bf5e
--- /dev/null
+++ b/extensions/core-cloud/deployment/pom.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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-core-cloud-parent</artifactId>
+        <version>0.1.1-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-core-cloud-deployment</artifactId>
+    <name>Camel Quarkus :: Core :: Cloud :: Deployment</name>
+
+    <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-core-cloud</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/extensions/core-cloud/pom.xml b/extensions/core-cloud/pom.xml
new file mode 100644
index 0000000..716b5b6
--- /dev/null
+++ b/extensions/core-cloud/pom.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>0.1.1-SNAPSHOT</version>
+        <relativePath>../../build-parent/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-core-cloud-parent</artifactId>
+    <name>Camel Quarkus :: Core :: Cloud</name>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>deployment</module>
+        <module>runtime</module>
+    </modules>
+</project>
diff --git a/extensions/core-cloud/runtime/pom.xml b/extensions/core-cloud/runtime/pom.xml
new file mode 100644
index 0000000..5b4abdc
--- /dev/null
+++ b/extensions/core-cloud/runtime/pom.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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-core-cloud-parent</artifactId>
+        <version>0.1.1-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-core-cloud</artifactId>
+    <name>Camel Quarkus :: Core :: Cloud :: Runtime</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-core</artifactId>
+        </dependency>
+
+        <!-- camel -->
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-cloud</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-caffeine</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.oracle.substratevm</groupId>
+            <artifactId>svm</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <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/core-cloud/runtime/src/main/java/org/apache/camel/core/cloud/graal/Target_org_apache_camel_impl_cloud_CachingServiceDiscovery.java b/extensions/core-cloud/runtime/src/main/java/org/apache/camel/core/cloud/graal/Target_org_apache_camel_impl_cloud_CachingServiceDiscovery.java
new file mode 100644
index 0000000..c124c25
--- /dev/null
+++ b/extensions/core-cloud/runtime/src/main/java/org/apache/camel/core/cloud/graal/Target_org_apache_camel_impl_cloud_CachingServiceDiscovery.java
@@ -0,0 +1,55 @@
+/**
+ * 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.core.cloud.graal;
+
+import java.util.List;
+import java.util.concurrent.Executor;
+import java.util.concurrent.ForkJoinPool;
+import java.util.concurrent.TimeUnit;
+
+import com.github.benmanes.caffeine.cache.Caffeine;
+import com.github.benmanes.caffeine.cache.LoadingCache;
+import com.oracle.svm.core.annotate.Alias;
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
+import org.apache.camel.cloud.ServiceDefinition;
+import org.apache.camel.cloud.ServiceDiscovery;
+
+@TargetClass(className = "org.apache.camel.impl.cloud.CachingServiceDiscovery")
+final class Target_org_apache_camel_impl_cloud_CachingServiceDiscovery {
+    @Alias
+    private ServiceDiscovery delegate;
+    @Alias
+    private LoadingCache<String, List<ServiceDefinition>> cache;
+    @Alias
+    private long timeout;
+
+    @Substitute
+    public void setTimeout(long timeout) {
+        this.timeout = timeout;
+        this.cache = Caffeine.newBuilder()
+            .executor(new Executor() {
+                @Override
+                public void execute(Runnable command) {
+                    // workaround for https://github.com/quarkusio/quarkus/issues/3300
+                    ForkJoinPool.commonPool().execute(command);
+                }
+            })
+            .expireAfterAccess(timeout, TimeUnit.MILLISECONDS)
+            .build(delegate::getServices);
+    }
+}
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 0fd7314..640b15e 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -37,6 +37,7 @@
         <module>xstream-common</module>
         <module>xml-common</module>
         <module>core</module>
+        <module>core-cloud</module>
 
         <!-- components -->
         <module>netty4-http</module>
diff --git a/integration-tests/core-impl/pom.xml b/integration-tests/core-impl/pom.xml
new file mode 100644
index 0000000..09eb256
--- /dev/null
+++ b/integration-tests/core-impl/pom.xml
@@ -0,0 +1,114 @@
+<?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">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-integration-tests</artifactId>
+        <version>0.1.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-integration-test-core-impl</artifactId>
+    <name>Camel Quarkus :: Integration Tests :: Core :: Impl</name>
+    <description>The camel integration tests</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-core-cloud</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>io.quarkus</groupId>
+                <artifactId>quarkus-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>build</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>native-image</id>
+            <activation>
+                <property>
+                    <name>native</name>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-failsafe-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>integration-test</goal>
+                                    <goal>verify</goal>
+                                </goals>
+                                <configuration>
+                                    <systemProperties>
+                                        <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
+                                    </systemProperties>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>io.quarkus</groupId>
+                        <artifactId>quarkus-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>native-image</id>
+                                <goals>
+                                    <goal>native-image</goal>
+                                </goals>
+                                <configuration>
+                                    <reportErrorsAtRuntime>false</reportErrorsAtRuntime>
+                                    <cleanupServer>true</cleanupServer>
+                                    <enableHttpUrlHandler>true</enableHttpUrlHandler>
+                                    <enableServer>false</enableServer>
+                                    <dumpProxies>false</dumpProxies>
+                                    <graalvmHome>${graalvmHome}</graalvmHome>
+                                    <enableJni>false</enableJni>
+                                    <disableReports>true</disableReports>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+
+</project>
diff --git a/integration-tests/core-impl/src/main/resources/application.properties b/integration-tests/core-impl/src/main/resources/application.properties
new file mode 100644
index 0000000..8f520a6
--- /dev/null
+++ b/integration-tests/core-impl/src/main/resources/application.properties
@@ -0,0 +1,33 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+#
+# Quarkus
+#
+quarkus.log.file.enable = false
+
+#
+# Quarkus :: Camel
+#
+quarkus.camel.disable-xml=true
+quarkus.camel.disable-jaxb=true
+quarkus.camel.dump-routes=true
+quarkus.camel.defer-init-phase=true
+
+#
+# Camel
+#
+camel.context.name=quarkus-camel-example
\ No newline at end of file
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 6859331..671edcf 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -35,7 +35,9 @@
     <modules>
         <!-- build those first -->
         <module>core</module>
+        <module>core-impl</module>
         <module>core-cdi</module>
+
         <module>netty4-http</module>
         <module>aws</module>
         <module>bean</module>