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 2020/01/02 15:58:36 UTC
[camel-quarkus] 01/01: Added AWS-Lambda extension
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch aws-lambda-ext
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 498ccccaee573f495fbf4c8a177131a98cb86b37
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Jan 2 16:57:57 2020 +0100
Added AWS-Lambda extension
---
.../pages/list-of-camel-quarkus-extensions.adoc | 5 +-
extensions/aws-lambda/deployment/pom.xml | 87 +++++++++++++++++
.../aws/lambda/deployment/AwsLambdaProcessor.java | 81 ++++++++++++++++
extensions/aws-lambda/pom.xml | 39 ++++++++
extensions/aws-lambda/runtime/pom.xml | 108 +++++++++++++++++++++
.../main/resources/META-INF/quarkus-extension.yaml | 29 ++++++
extensions/pom.xml | 1 +
extensions/readme.adoc | 5 +-
integration-tests/aws/pom.xml | 4 +
.../camel/quarkus/component/aws/CamelRoute.java | 4 +
.../aws/src/main/resources/application.properties | 9 +-
poms/bom-deployment/pom.xml | 5 +
poms/bom/pom.xml | 10 ++
13 files changed, 384 insertions(+), 3 deletions(-)
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 1967299..646789c 100644
--- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
+++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
@@ -6,7 +6,7 @@ As of Camel Quarkus {camel-quarkus-last-release} the following Camel artifacts a
== Camel Components
// components: START
-Number of Camel components: 53 in 45 JAR artifacts (0 deprecated)
+Number of Camel components: 54 in 46 JAR artifacts (0 deprecated)
[width="100%",cols="4,1,5",options="header"]
|===
@@ -30,6 +30,9 @@ Number of Camel components: 53 in 45 JAR artifacts (0 deprecated)
| link:https://camel.apache.org/components/latest/aws-kms-component.html[AWS KMS] (camel-quarkus-aws-kms) +
`aws-kms:label` | 1.0.0-M1 | The aws-kms is used for managing Amazon KMS
+| link:https://camel.apache.org/components/latest/aws-lambda-component.html[AWS Lambda] (camel-quarkus-aws-lambda) +
+`aws-lambda:function` | 1.2.0 | The aws-lambda is used for managing and invoking functions from Amazon Lambda.
+
| link:https://camel.apache.org/components/latest/aws-s3-component.html[AWS S3 Storage Service] (camel-quarkus-aws-s3) +
`aws-s3://bucketNameOrArn` | 0.2.0 | The aws-s3 component is used for storing and retrieving object from Amazon S3 Storage Service.
diff --git a/extensions/aws-lambda/deployment/pom.xml b/extensions/aws-lambda/deployment/pom.xml
new file mode 100644
index 0000000..5e87dd9
--- /dev/null
+++ b/extensions/aws-lambda/deployment/pom.xml
@@ -0,0 +1,87 @@
+<?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-aws-lambda-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-aws-lambda-deployment</artifactId>
+ <name>Camel Quarkus :: AWS Lambda :: 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-support-xml-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-commons-logging-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-aws-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-aws-lambda</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/aws-lambda/deployment/src/main/java/org/apache/camel/quarkus/component/aws/lambda/deployment/AwsLambdaProcessor.java b/extensions/aws-lambda/deployment/src/main/java/org/apache/camel/quarkus/component/aws/lambda/deployment/AwsLambdaProcessor.java
new file mode 100644
index 0000000..f786b32
--- /dev/null
+++ b/extensions/aws-lambda/deployment/src/main/java/org/apache/camel/quarkus/component/aws/lambda/deployment/AwsLambdaProcessor.java
@@ -0,0 +1,81 @@
+/*
+ * 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.component.aws.lambda.deployment;
+
+import java.util.Collection;
+import java.util.stream.Collectors;
+
+import org.apache.camel.component.aws.lambda.LambdaConfiguration;
+import org.jboss.jandex.ClassInfo;
+import org.jboss.jandex.DotName;
+import org.jboss.jandex.IndexView;
+
+import com.amazonaws.partitions.model.CredentialScope;
+import com.amazonaws.partitions.model.Endpoint;
+import com.amazonaws.partitions.model.Partition;
+import com.amazonaws.partitions.model.Partitions;
+import com.amazonaws.partitions.model.Region;
+import com.amazonaws.partitions.model.Service;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+
+class AwsLambdaProcessor {
+
+ public static final String AWS_LAMBDA_APPLICATION_ARCHIVE_MARKERS = "com/amazonaws";
+
+ private static final String FEATURE = "camel-aws-lambda";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+
+ @BuildStep
+ ExtensionSslNativeSupportBuildItem activateSslNativeSupport() {
+ return new ExtensionSslNativeSupportBuildItem(FEATURE);
+ }
+
+ @BuildStep(applicationArchiveMarkers = { AWS_LAMBDA_APPLICATION_ARCHIVE_MARKERS })
+ void process(CombinedIndexBuildItem combinedIndexBuildItem,
+ BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
+ BuildProducer<NativeImageResourceBuildItem> resource) {
+
+ IndexView view = combinedIndexBuildItem.getIndex();
+
+ resource.produce(new NativeImageResourceBuildItem("com/amazonaws/partitions/endpoints.json"));
+ reflectiveClass.produce(new ReflectiveClassBuildItem(true, false,
+ Partitions.class.getCanonicalName(),
+ Partition.class.getCanonicalName(),
+ Endpoint.class.getCanonicalName(),
+ Region.class.getCanonicalName(),
+ Service.class.getCanonicalName(),
+ CredentialScope.class.getCanonicalName(),
+ LambdaConfiguration.class.getCanonicalName()));
+ }
+
+ protected Collection<String> getImplementations(IndexView view, Class<?> type) {
+ return view.getAllKnownImplementors(DotName.createSimple(type.getName())).stream()
+ .map(ClassInfo::toString)
+ .collect(Collectors.toList());
+ }
+}
diff --git a/extensions/aws-lambda/pom.xml b/extensions/aws-lambda/pom.xml
new file mode 100644
index 0000000..76015ec
--- /dev/null
+++ b/extensions/aws-lambda/pom.xml
@@ -0,0 +1,39 @@
+<?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-aws-lambda-parent</artifactId>
+ <name>Camel Quarkus :: AWS Lambda</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>deployment</module>
+ <module>runtime</module>
+ </modules>
+</project>
diff --git a/extensions/aws-lambda/runtime/pom.xml b/extensions/aws-lambda/runtime/pom.xml
new file mode 100644
index 0000000..7f3afbb
--- /dev/null
+++ b/extensions/aws-lambda/runtime/pom.xml
@@ -0,0 +1,108 @@
+<?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-aws-lambda-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-aws-lambda</artifactId>
+ <name>Camel Quarkus :: AWS Lambda :: Runtime</name>
+
+ <properties>
+ <firstVersion>1.2.0</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.quarkus</groupId>
+ <artifactId>camel-quarkus-support-aws</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-xml</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-commons-logging</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-aws-lambda</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-cbor</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </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/aws-lambda/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/aws-lambda/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000..ad49067
--- /dev/null
+++ b/extensions/aws-lambda/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.
+#
+
+---
+name: "Camel Quarkus AWS Lambda"
+description: "A Camel Amazon Lambda Web Service Component"
+metadata:
+ keywords:
+ - "camel"
+ - "aws"
+ - "cloud"
+ - "serverless"
+ guide: "https://quarkus.io/guides/camel"
+ categories:
+ - "integration"
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 22d2146..35dae49 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -101,6 +101,7 @@
<module>vm</module>
<module>xslt</module>
<module>zipfile</module>
+ <module>aws-lambda</module>
</modules>
<build>
diff --git a/extensions/readme.adoc b/extensions/readme.adoc
index 97553fe..be0e241 100644
--- a/extensions/readme.adoc
+++ b/extensions/readme.adoc
@@ -5,7 +5,7 @@ Apache Camel Quarkus supports the following Camel artifacts as Quarkus Extension
== Camel Components
// components: START
-Number of Camel components: 53 in 45 JAR artifacts (0 deprecated)
+Number of Camel components: 54 in 46 JAR artifacts (0 deprecated)
[width="100%",cols="4,1,5",options="header"]
|===
@@ -29,6 +29,9 @@ Number of Camel components: 53 in 45 JAR artifacts (0 deprecated)
| link:https://camel.apache.org/components/latest/aws-kms-component.html[AWS KMS] (camel-quarkus-aws-kms) +
`aws-kms:label` | 1.0.0-M1 | The aws-kms is used for managing Amazon KMS
+| link:https://camel.apache.org/components/latest/aws-lambda-component.html[AWS Lambda] (camel-quarkus-aws-lambda) +
+`aws-lambda:function` | 1.2.0 | The aws-lambda is used for managing and invoking functions from Amazon Lambda.
+
| link:https://camel.apache.org/components/latest/aws-s3-component.html[AWS S3 Storage Service] (camel-quarkus-aws-s3) +
`aws-s3://bucketNameOrArn` | 0.2.0 | The aws-s3 component is used for storing and retrieving object from Amazon S3 Storage Service.
diff --git a/integration-tests/aws/pom.xml b/integration-tests/aws/pom.xml
index a62973f..ba57aee 100644
--- a/integration-tests/aws/pom.xml
+++ b/integration-tests/aws/pom.xml
@@ -64,6 +64,10 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-aws-lambda</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-log</artifactId>
</dependency>
<dependency>
diff --git a/integration-tests/aws/src/main/java/org/apache/camel/quarkus/component/aws/CamelRoute.java b/integration-tests/aws/src/main/java/org/apache/camel/quarkus/component/aws/CamelRoute.java
index c3a58ed..5efbabf 100644
--- a/integration-tests/aws/src/main/java/org/apache/camel/quarkus/component/aws/CamelRoute.java
+++ b/integration-tests/aws/src/main/java/org/apache/camel/quarkus/component/aws/CamelRoute.java
@@ -61,6 +61,10 @@ public class CamelRoute extends RouteBuilder {
from("timer:quarkus-ec2?repeatCount=1")
.to("aws-ec2://cluster?operation=describeInstances")
.to("log:sf?showAll=true");
+
+ from("timer:quarkus-lambda?repeatCount=1")
+ .to("aws-lambda://cluster?operation=listFunctions")
+ .to("log:sf?showAll=true");
}
}
diff --git a/integration-tests/aws/src/main/resources/application.properties b/integration-tests/aws/src/main/resources/application.properties
index 8aa80e2..5ab71a5 100644
--- a/integration-tests/aws/src/main/resources/application.properties
+++ b/integration-tests/aws/src/main/resources/application.properties
@@ -79,4 +79,11 @@ camel.component.aws-iam.region={{env:AWS_REGION}}
#
camel.component.aws-ec2.access-key={{env:AWS_ACCESS_KEY}}
camel.component.aws-ec2.secret-key={{env:AWS_SECRET_KEY}}
-camel.component.aws-ec2.region={{env:AWS_REGION}}
\ No newline at end of file
+camel.component.aws-ec2.region={{env:AWS_REGION}}
+
+#
+# Camel :: AWS Lambda
+#
+camel.component.aws-lambda.access-key={{env:AWS_ACCESS_KEY}}
+camel.component.aws-lambda.secret-key={{env:AWS_SECRET_KEY}}
+camel.component.aws-lambda.region={{env:AWS_REGION}}
\ No newline at end of file
diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml
index baa5c7c..5dcf520 100644
--- a/poms/bom-deployment/pom.xml
+++ b/poms/bom-deployment/pom.xml
@@ -419,6 +419,11 @@
<artifactId>camel-quarkus-zipfile-deployment</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-aws-lambda-deployment</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index 7105c1e..99d39dd 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -88,6 +88,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-aws-lambda</artifactId>
+ <version>${camel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-aws-kms</artifactId>
<version>${camel.version}</version>
</dependency>
@@ -849,6 +854,11 @@
<artifactId>xalan</artifactId>
<version>${xalan.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-aws-lambda</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>