Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an AWS2-CW native extension #1134

Merged
merged 1 commit into from
Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ Level | Since | Description
Preview | 1.0.0-M6 | Working with Apache Avro for data serialization.

| link:https://camel.apache.org/components/latest/aws2-cw-component.html[AWS 2 CloudWatch] (camel-quarkus-aws2-cw) +
`aws2-cw:namespace` | JVM +
Preview | 1.0.0-M6 | The aws2-cw component is used for sending metrics to an Amazon CloudWatch.
`aws2-cw:namespace` | Native +
Stable | 1.0.0-M6 | The aws2-cw component is used for sending metrics to an Amazon CloudWatch.

| link:https://camel.apache.org/components/latest/aws2-ddb-component.html[AWS 2 DynamoDB] (camel-quarkus-aws2-ddb) +
`aws2-ddb:tableName` | JVM +
Expand Down

This file was deleted.

80 changes: 0 additions & 80 deletions extensions-jvm/aws2-cw/integration-test/pom.xml

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion extensions-jvm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
<!-- extensions a..z; do not remove this comment, it is important when sorting via mvn process-resources -Pformat -->
<module>avro</module>
<module>avro-rpc</module>
<module>aws2-cw</module>
<module>aws2-ddb</module>
<module>aws2-ec2</module>
<module>aws2-ecs</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-cw</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-aws2-deployment</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* 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.aws2.cw.deployment;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import org.jboss.jandex.DotName;
import software.amazon.awssdk.core.interceptor.ExecutionInterceptor;

class Aws2CwProcessor {

private static final String FEATURE = "camel-aws2-cw";

public static final String AWS_SDK_APPLICATION_ARCHIVE_MARKERS = "software/amazon/awssdk";

private static final List<String> INTERCEPTOR_PATHS = Arrays.asList(
"software/amazon/awssdk/global/handlers/execution.interceptors");

private static final DotName EXECUTION_INTERCEPTOR_NAME = DotName.createSimple(ExecutionInterceptor.class.getName());

@BuildStep
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}

@BuildStep(applicationArchiveMarkers = { AWS_SDK_APPLICATION_ARCHIVE_MARKERS })
void process(CombinedIndexBuildItem combinedIndexBuildItem,
BuildProducer<ReflectiveClassBuildItem> reflectiveClasses,
BuildProducer<NativeImageResourceBuildItem> resource) {

INTERCEPTOR_PATHS.forEach(path -> resource.produce(new NativeImageResourceBuildItem(path)));

List<String> knownInterceptorImpls = combinedIndexBuildItem.getIndex()
.getAllKnownImplementors(EXECUTION_INTERCEPTOR_NAME)
.stream()
.map(c -> c.name().toString()).collect(Collectors.toList());

reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false,
knownInterceptorImpls.toArray(new String[knownInterceptorImpls.size()])));

reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false,
String.class.getCanonicalName()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,5 @@
<modules>
<module>deployment</module>
<module>runtime</module>
<module>integration-test</module>
</modules>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-aws2-cw</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-support-aws2</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>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
name: "AWS 2 CloudWatch"
description: "The aws2-cw component is used for sending metrics to an Amazon CloudWatch."
metadata:
unlisted: true
keywords:
- "camel"
- "aws"
- "cloud"
- "monitoring"
guide: "https://camel.apache.org/components/latest/aws2-cw-component.html"
guide: "https://quarkus.io/guides/camel"
categories:
- "integration"
status: "preview"
1 change: 1 addition & 0 deletions extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<module>aws-sqs</module>
<module>aws-swf</module>
<module>aws-translate</module>
<module>aws2-cw</module>
<module>aws2-s3</module>
<module>aws2-sns</module>
<module>aws2-sqs</module>
Expand Down
4 changes: 4 additions & 0 deletions integration-tests/aws2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-cw</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-s3</artifactId>
Expand Down