You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2021/11/02 11:53:43 UTC
[camel-quarkus] 01/03: Make sure all AWS extensions tested with
Quarkus clients have the option documented #3201
This is an automated email from the ASF dual-hosted git repository.
ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 68128019338a87e7e19e9dd4316c6842bfa27434
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue Nov 2 08:59:32 2021 +0100
Make sure all AWS extensions tested with Quarkus clients have the option documented #3201
---
.../ROOT/pages/reference/extensions/aws2-ddb.adoc | 13 ++--
.../ROOT/pages/reference/extensions/aws2-s3.adoc | 44 ++-----------
.../ROOT/pages/reference/extensions/aws2-ses.adoc | 32 ++++++++++
.../ROOT/pages/reference/extensions/aws2-sns.adoc | 32 ++++++++++
.../ROOT/pages/reference/extensions/aws2-sqs.adoc | 32 ++++++++++
extensions/aws2-ddb/runtime/pom.xml | 2 +
.../runtime/src/main/doc/configuration.adoc | 29 ---------
extensions/aws2-s3/runtime/pom.xml | 2 +
.../runtime/src/main/doc/configuration.adoc | 62 -------------------
extensions/aws2-ses/runtime/pom.xml | 2 +
extensions/aws2-sns/runtime/pom.xml | 2 +
extensions/aws2-sqs/runtime/pom.xml | 2 +
.../camel/quarkus/maven/CamelQuarkusExtension.java | 20 +++++-
.../quarkus/maven/UpdateExtensionDocPageMojo.java | 72 ++++++++++++++++++++++
.../doc-templates/extension-doc-page.adoc | 34 +++++++++-
15 files changed, 240 insertions(+), 140 deletions(-)
diff --git a/docs/modules/ROOT/pages/reference/extensions/aws2-ddb.adoc b/docs/modules/ROOT/pages/reference/extensions/aws2-ddb.adoc
index 10eb0d3..6405044 100644
--- a/docs/modules/ROOT/pages/reference/extensions/aws2-ddb.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/aws2-ddb.adoc
@@ -50,18 +50,18 @@ https://quarkus.io/guides/native-and-ssl[Quarkus SSL guide].
=== Optional integration with Quarkus Amazon DynamoDB
-If desired, it is possible to use the Quarkus Amazon DynamoDB Client extension in conjunction with Camel Quarkus AWS2 DDB.
-Note that this is fully optional and not at all mandatory.
-Follow the https://quarkus.io/guides/amazon-dynamodb#configuring-dynamodb-clients[Quarkus documentation] with some caveats.
+If desired, it is possible to use the Quarkus Amazon DynamoDB extension in conjunction with Camel Quarkus AWS 2 DynamoDB.
+Note that this is fully optional and not mandatory at all.
+Please follow the https://quarkus.io/guides/amazon-dynamodb#configuring-dynamodb-clients[Quarkus documentation] but beware of the following caveats:
-1. The Apache client type has to be selected by configuring the following property.
+1. The client type `apache` has to be selected by configuring the following property:
+
[source,properties]
----
quarkus.dynamodb.sync-client.type=apache
----
-2. The `DynamoDbClient` has to be "unremovable" in the sense of https://quarkus.io/guides/cdi-reference#remove_unused_beans[Quarkus CDI reference] so that Camel Quarkus is able to look it up at runtime.
+2. The `DynamoDbClient` has to be made "unremovable" in the sense of https://quarkus.io/guides/cdi-reference#remove_unused_beans[Quarkus CDI reference] so that Camel Quarkus is able to look it up at runtime.
You can reach that e.g. by adding a dummy bean injecting `DynamoDbClient`:
+
[source,java]
@@ -74,7 +74,6 @@ import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
@Unremovable
class UnremovableDynamoDbClient {
@Inject
- DynamoDbClient dynamoDB;
+ DynamoDbClient dynamoDbClient;
}
----
-
diff --git a/docs/modules/ROOT/pages/reference/extensions/aws2-s3.adoc b/docs/modules/ROOT/pages/reference/extensions/aws2-s3.adoc
index 9863b00..76949c9 100644
--- a/docs/modules/ROOT/pages/reference/extensions/aws2-s3.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/aws2-s3.adoc
@@ -49,18 +49,18 @@ https://quarkus.io/guides/native-and-ssl[Quarkus SSL guide].
=== Optional integration with Quarkus Amazon S3
-If desired, it is possible to use the Quarkus Amazon S3 Client extension in conjunction with Camel Quarkus AWS2 S3.
-Note that this is fully optional and not at all mandatory.
-Follow the https://quarkus.io/guides/amazon-s3#configuring-s3-clients[Quarkus documentation] with some caveats.
+If desired, it is possible to use the Quarkus Amazon S3 extension in conjunction with Camel Quarkus AWS 2 S3 Storage Service.
+Note that this is fully optional and not mandatory at all.
+Please follow the https://quarkus.io/guides/amazon-s3#configuring-s3-clients[Quarkus documentation] but beware of the following caveats:
-1. The Apache client type has to be selected by configuring the following property.
+1. The client type `apache` has to be selected by configuring the following property:
+
[source,properties]
----
quarkus.s3.sync-client.type=apache
----
-2. The `S3Client` has to be "unremovable" in the sense of https://quarkus.io/guides/cdi-reference#remove_unused_beans[Quarkus CDI reference] so that Camel Quarkus is able to look it up at runtime.
+2. The `S3Client` has to be made "unremovable" in the sense of https://quarkus.io/guides/cdi-reference#remove_unused_beans[Quarkus CDI reference] so that Camel Quarkus is able to look it up at runtime.
You can reach that e.g. by adding a dummy bean injecting `S3Client`:
+
[source,java]
@@ -76,37 +76,3 @@ class UnremovableS3Client {
S3Client s3Client;
}
----
-
-=== Multipart Upload
-When you use multipart uploads with a file size larger than xref:{cq-camel-components}::aws2-s3-component.adoc#_component_option_partSize[partSize] (the default is 25M, and the low limit is 5M according to https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html).
-The getObject operation after uploading returns a result which contains ```chunk_signature```.
-
-If you want to get rid of these signatures, you have to create your own instance of ```S3Client``` just like
-
-[source,java]
-----
-import javax.enterprise.inject.Produces;
-
-import software.amazon.awssdk.services.s3.S3Client;
-import software.amazon.awssdk.services.s3.S3ClientBuilder;
-import software.amazon.awssdk.services.s3.S3Configuration;
-
-@Produces
-public S3Client getClient() {
- S3ClientBuilder builder = S3Client.builder();
- S3Configuration.Builder s3ConfigBuilder = S3Configuration.builder()
- .checksumValidationEnabled(false)
- .chunkedEncodingEnabled(false);
- builder.serviceConfiguration(s3ConfigBuilder.build());
-
- return builder.build();
-}
-----
-
-or if you use the Quarkus Amazon S3 Client extension, you need to set
-[source,properties]
-----
-quarkus.s3.chunked-encoding=false
-quarkus.s3.checksum-validation=false
-----
-
diff --git a/docs/modules/ROOT/pages/reference/extensions/aws2-ses.adoc b/docs/modules/ROOT/pages/reference/extensions/aws2-ses.adoc
index 7c23e50..1875c4a 100644
--- a/docs/modules/ROOT/pages/reference/extensions/aws2-ses.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/aws2-ses.adoc
@@ -44,3 +44,35 @@ Check the xref:user-guide/index.adoc[User guide] for more information about writ
This extension auto-enables SSL support in native mode. Hence you do not need to add
`quarkus.ssl.native=true` to your `application.properties` yourself. See also
https://quarkus.io/guides/native-and-ssl[Quarkus SSL guide].
+
+== Additional Camel Quarkus configuration
+
+=== Optional integration with Quarkus Amazon SES
+
+If desired, it is possible to use the Quarkus Amazon SES extension in conjunction with Camel Quarkus AWS 2 Simple Email Service (SES).
+Note that this is fully optional and not mandatory at all.
+Please follow the https://quarkus.io/guides/amazon-ses#configuring-ses-clients[Quarkus documentation] but beware of the following caveats:
+
+1. The client type `apache` has to be selected by configuring the following property:
++
+[source,properties]
+----
+quarkus.ses.sync-client.type=apache
+----
+
+2. The `SesClient` has to be made "unremovable" in the sense of https://quarkus.io/guides/cdi-reference#remove_unused_beans[Quarkus CDI reference] so that Camel Quarkus is able to look it up at runtime.
+You can reach that e.g. by adding a dummy bean injecting `SesClient`:
++
+[source,java]
+----
+import javax.enterprise.context.ApplicationScoped;
+import io.quarkus.arc.Unremovable;
+import software.amazon.awssdk.services.ses.SesClient;
+
+@ApplicationScoped
+@Unremovable
+class UnremovableSesClient {
+ @Inject
+ SesClient sesClient;
+}
+----
diff --git a/docs/modules/ROOT/pages/reference/extensions/aws2-sns.adoc b/docs/modules/ROOT/pages/reference/extensions/aws2-sns.adoc
index 53ae000..438e8f3 100644
--- a/docs/modules/ROOT/pages/reference/extensions/aws2-sns.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/aws2-sns.adoc
@@ -44,3 +44,35 @@ Check the xref:user-guide/index.adoc[User guide] for more information about writ
This extension auto-enables SSL support in native mode. Hence you do not need to add
`quarkus.ssl.native=true` to your `application.properties` yourself. See also
https://quarkus.io/guides/native-and-ssl[Quarkus SSL guide].
+
+== Additional Camel Quarkus configuration
+
+=== Optional integration with Quarkus Amazon SNS
+
+If desired, it is possible to use the Quarkus Amazon SNS extension in conjunction with Camel Quarkus AWS 2 Simple Notification System (SNS).
+Note that this is fully optional and not mandatory at all.
+Please follow the https://quarkus.io/guides/amazon-sns#configuring-sns-clients[Quarkus documentation] but beware of the following caveats:
+
+1. The client type `apache` has to be selected by configuring the following property:
++
+[source,properties]
+----
+quarkus.sns.sync-client.type=apache
+----
+
+2. The `SnsClient` has to be made "unremovable" in the sense of https://quarkus.io/guides/cdi-reference#remove_unused_beans[Quarkus CDI reference] so that Camel Quarkus is able to look it up at runtime.
+You can reach that e.g. by adding a dummy bean injecting `SnsClient`:
++
+[source,java]
+----
+import javax.enterprise.context.ApplicationScoped;
+import io.quarkus.arc.Unremovable;
+import software.amazon.awssdk.services.sns.SnsClient;
+
+@ApplicationScoped
+@Unremovable
+class UnremovableSnsClient {
+ @Inject
+ SnsClient snsClient;
+}
+----
diff --git a/docs/modules/ROOT/pages/reference/extensions/aws2-sqs.adoc b/docs/modules/ROOT/pages/reference/extensions/aws2-sqs.adoc
index be179d2..168c8dc 100644
--- a/docs/modules/ROOT/pages/reference/extensions/aws2-sqs.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/aws2-sqs.adoc
@@ -44,3 +44,35 @@ Check the xref:user-guide/index.adoc[User guide] for more information about writ
This extension auto-enables SSL support in native mode. Hence you do not need to add
`quarkus.ssl.native=true` to your `application.properties` yourself. See also
https://quarkus.io/guides/native-and-ssl[Quarkus SSL guide].
+
+== Additional Camel Quarkus configuration
+
+=== Optional integration with Quarkus Amazon SQS
+
+If desired, it is possible to use the Quarkus Amazon SQS extension in conjunction with Camel Quarkus AWS 2 Simple Queue Service (SQS).
+Note that this is fully optional and not mandatory at all.
+Please follow the https://quarkus.io/guides/amazon-sqs#configuring-sqs-clients[Quarkus documentation] but beware of the following caveats:
+
+1. The client type `apache` has to be selected by configuring the following property:
++
+[source,properties]
+----
+quarkus.sqs.sync-client.type=apache
+----
+
+2. The `SqsClient` has to be made "unremovable" in the sense of https://quarkus.io/guides/cdi-reference#remove_unused_beans[Quarkus CDI reference] so that Camel Quarkus is able to look it up at runtime.
+You can reach that e.g. by adding a dummy bean injecting `SqsClient`:
++
+[source,java]
+----
+import javax.enterprise.context.ApplicationScoped;
+import io.quarkus.arc.Unremovable;
+import software.amazon.awssdk.services.sqs.SqsClient;
+
+@ApplicationScoped
+@Unremovable
+class UnremovableSqsClient {
+ @Inject
+ SqsClient sqsClient;
+}
+----
diff --git a/extensions/aws2-ddb/runtime/pom.xml b/extensions/aws2-ddb/runtime/pom.xml
index 06828e8..2d1228b 100644
--- a/extensions/aws2-ddb/runtime/pom.xml
+++ b/extensions/aws2-ddb/runtime/pom.xml
@@ -33,6 +33,8 @@
<properties>
<camel.quarkus.jvmSince>1.0.0</camel.quarkus.jvmSince>
<camel.quarkus.nativeSince>1.0.0</camel.quarkus.nativeSince>
+ <cq.quarkus.aws.client.baseName>DynamoDB</cq.quarkus.aws.client.baseName>
+ <cq.quarkus.aws.client.fqClassName>software.amazon.awssdk.services.dynamodb.DynamoDbClient</cq.quarkus.aws.client.fqClassName>
</properties>
<dependencyManagement>
diff --git a/extensions/aws2-ddb/runtime/src/main/doc/configuration.adoc b/extensions/aws2-ddb/runtime/src/main/doc/configuration.adoc
deleted file mode 100644
index b74af43..0000000
--- a/extensions/aws2-ddb/runtime/src/main/doc/configuration.adoc
+++ /dev/null
@@ -1,29 +0,0 @@
-=== Optional integration with Quarkus Amazon DynamoDB
-
-If desired, it is possible to use the Quarkus Amazon DynamoDB Client extension in conjunction with Camel Quarkus AWS2 DDB.
-Note that this is fully optional and not at all mandatory.
-Follow the https://quarkus.io/guides/amazon-dynamodb#configuring-dynamodb-clients[Quarkus documentation] with some caveats.
-
-1. The Apache client type has to be selected by configuring the following property.
-+
-[source,properties]
-----
-quarkus.dynamodb.sync-client.type=apache
-----
-
-2. The `DynamoDbClient` has to be "unremovable" in the sense of https://quarkus.io/guides/cdi-reference#remove_unused_beans[Quarkus CDI reference] so that Camel Quarkus is able to look it up at runtime.
-You can reach that e.g. by adding a dummy bean injecting `DynamoDbClient`:
-+
-[source,java]
-----
-import javax.enterprise.context.ApplicationScoped;
-import io.quarkus.arc.Unremovable;
-import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
-
-@ApplicationScoped
-@Unremovable
-class UnremovableDynamoDbClient {
- @Inject
- DynamoDbClient dynamoDB;
-}
-----
diff --git a/extensions/aws2-s3/runtime/pom.xml b/extensions/aws2-s3/runtime/pom.xml
index 4c5d3bd..e5f11ec 100644
--- a/extensions/aws2-s3/runtime/pom.xml
+++ b/extensions/aws2-s3/runtime/pom.xml
@@ -33,6 +33,8 @@
<camel.quarkus.jvmSince>1.0.0</camel.quarkus.jvmSince>
<camel.quarkus.nativeSince>1.0.0</camel.quarkus.nativeSince>
<quarkus.metadata.keywords>Amazon</quarkus.metadata.keywords>
+ <cq.quarkus.aws.client.baseName>S3</cq.quarkus.aws.client.baseName>
+ <cq.quarkus.aws.client.fqClassName>software.amazon.awssdk.services.s3.S3Client</cq.quarkus.aws.client.fqClassName>
</properties>
<dependencyManagement>
diff --git a/extensions/aws2-s3/runtime/src/main/doc/configuration.adoc b/extensions/aws2-s3/runtime/src/main/doc/configuration.adoc
deleted file mode 100644
index e1f55aa..0000000
--- a/extensions/aws2-s3/runtime/src/main/doc/configuration.adoc
+++ /dev/null
@@ -1,62 +0,0 @@
-=== Optional integration with Quarkus Amazon S3
-
-If desired, it is possible to use the Quarkus Amazon S3 Client extension in conjunction with Camel Quarkus AWS2 S3.
-Note that this is fully optional and not at all mandatory.
-Follow the https://quarkus.io/guides/amazon-s3#configuring-s3-clients[Quarkus documentation] with some caveats.
-
-1. The Apache client type has to be selected by configuring the following property.
-+
-[source,properties]
-----
-quarkus.s3.sync-client.type=apache
-----
-
-2. The `S3Client` has to be "unremovable" in the sense of https://quarkus.io/guides/cdi-reference#remove_unused_beans[Quarkus CDI reference] so that Camel Quarkus is able to look it up at runtime.
-You can reach that e.g. by adding a dummy bean injecting `S3Client`:
-+
-[source,java]
-----
-import javax.enterprise.context.ApplicationScoped;
-import io.quarkus.arc.Unremovable;
-import software.amazon.awssdk.services.s3.S3Client;
-
-@ApplicationScoped
-@Unremovable
-class UnremovableS3Client {
- @Inject
- S3Client s3Client;
-}
-----
-
-=== Multipart Upload
-When you use multipart uploads with a file size larger than xref:{cq-camel-components}::aws2-s3-component.adoc#_component_option_partSize[partSize] (the default is 25M, and the low limit is 5M according to https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html).
-The getObject operation after uploading returns a result which contains ```chunk_signature```.
-
-If you want to get rid of these signatures, you have to create your own instance of ```S3Client``` just like
-
-[source,java]
-----
-import javax.enterprise.inject.Produces;
-
-import software.amazon.awssdk.services.s3.S3Client;
-import software.amazon.awssdk.services.s3.S3ClientBuilder;
-import software.amazon.awssdk.services.s3.S3Configuration;
-
-@Produces
-public S3Client getClient() {
- S3ClientBuilder builder = S3Client.builder();
- S3Configuration.Builder s3ConfigBuilder = S3Configuration.builder()
- .checksumValidationEnabled(false)
- .chunkedEncodingEnabled(false);
- builder.serviceConfiguration(s3ConfigBuilder.build());
-
- return builder.build();
-}
-----
-
-or if you use the Quarkus Amazon S3 Client extension, you need to set
-[source,properties]
-----
-quarkus.s3.chunked-encoding=false
-quarkus.s3.checksum-validation=false
-----
diff --git a/extensions/aws2-ses/runtime/pom.xml b/extensions/aws2-ses/runtime/pom.xml
index 63d03f2..55ba80b 100644
--- a/extensions/aws2-ses/runtime/pom.xml
+++ b/extensions/aws2-ses/runtime/pom.xml
@@ -32,6 +32,8 @@
<properties>
<camel.quarkus.jvmSince>1.0.0</camel.quarkus.jvmSince>
<camel.quarkus.nativeSince>1.0.0</camel.quarkus.nativeSince>
+ <cq.quarkus.aws.client.baseName>SES</cq.quarkus.aws.client.baseName>
+ <cq.quarkus.aws.client.fqClassName>software.amazon.awssdk.services.ses.SesClient</cq.quarkus.aws.client.fqClassName>
</properties>
<dependencyManagement>
diff --git a/extensions/aws2-sns/runtime/pom.xml b/extensions/aws2-sns/runtime/pom.xml
index 9518cd4..0aac8ed 100644
--- a/extensions/aws2-sns/runtime/pom.xml
+++ b/extensions/aws2-sns/runtime/pom.xml
@@ -33,6 +33,8 @@
<camel.quarkus.jvmSince>1.0.0</camel.quarkus.jvmSince>
<camel.quarkus.nativeSince>1.0.0</camel.quarkus.nativeSince>
<quarkus.metadata.keywords>Amazon</quarkus.metadata.keywords>
+ <cq.quarkus.aws.client.baseName>SNS</cq.quarkus.aws.client.baseName>
+ <cq.quarkus.aws.client.fqClassName>software.amazon.awssdk.services.sns.SnsClient</cq.quarkus.aws.client.fqClassName>
</properties>
<dependencyManagement>
diff --git a/extensions/aws2-sqs/runtime/pom.xml b/extensions/aws2-sqs/runtime/pom.xml
index 014a6f8..da4b926 100644
--- a/extensions/aws2-sqs/runtime/pom.xml
+++ b/extensions/aws2-sqs/runtime/pom.xml
@@ -33,6 +33,8 @@
<camel.quarkus.jvmSince>1.0.0</camel.quarkus.jvmSince>
<camel.quarkus.nativeSince>1.0.0</camel.quarkus.nativeSince>
<quarkus.metadata.keywords>Amazon</quarkus.metadata.keywords>
+ <cq.quarkus.aws.client.baseName>SQS</cq.quarkus.aws.client.baseName>
+ <cq.quarkus.aws.client.fqClassName>software.amazon.awssdk.services.sqs.SqsClient</cq.quarkus.aws.client.fqClassName>
</properties>
<dependencyManagement>
diff --git a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/CamelQuarkusExtension.java b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/CamelQuarkusExtension.java
index b4c288f..c6999ca 100644
--- a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/CamelQuarkusExtension.java
+++ b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/CamelQuarkusExtension.java
@@ -93,7 +93,9 @@ public class CamelQuarkusExtension {
status,
unlisted,
deps == null ? Collections.emptyList() : Collections.unmodifiableList(deps),
- kind);
+ kind,
+ props.getProperty("cq.quarkus.aws.client.baseName"),
+ props.getProperty("cq.quarkus.aws.client.fqClassName"));
} catch (IOException | XmlPullParserException e) {
throw new RuntimeException("Could not read " + runtimePomXmlPath, e);
}
@@ -113,6 +115,8 @@ public class CamelQuarkusExtension {
private final ExtensionStatus status;
private final boolean unlisted;
private final Kind kind;
+ private final String quarkusAwsClientBaseName;
+ private final String quarkusAwsClientFqClassName;
public CamelQuarkusExtension(
Path runtimePomXmlPath,
@@ -128,7 +132,9 @@ public class CamelQuarkusExtension {
ExtensionStatus status,
boolean unlisted,
List<Dependency> dependencies,
- Kind kind) {
+ Kind kind,
+ String quarkusAwsClientBaseName,
+ String quarkusAwsClientFqClassName) {
super();
this.runtimePomXmlPath = runtimePomXmlPath;
this.camelComponentArtifactId = camelComponentArtifactId;
@@ -144,6 +150,8 @@ public class CamelQuarkusExtension {
this.unlisted = unlisted;
this.dependencies = dependencies;
this.kind = kind;
+ this.quarkusAwsClientBaseName = quarkusAwsClientBaseName;
+ this.quarkusAwsClientFqClassName = quarkusAwsClientFqClassName;
}
public String getVersion() {
@@ -206,4 +214,12 @@ public class CamelQuarkusExtension {
return kind;
}
+ public Optional<String> getQuarkusAwsClientBaseName() {
+ return Optional.ofNullable(quarkusAwsClientBaseName);
+ }
+
+ public Optional<String> getQuarkusAwsClientFqClassName() {
+ return Optional.ofNullable(quarkusAwsClientFqClassName);
+ }
+
}
diff --git a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateExtensionDocPageMojo.java b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateExtensionDocPageMojo.java
index c69e764..deba1bd 100644
--- a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateExtensionDocPageMojo.java
+++ b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateExtensionDocPageMojo.java
@@ -27,7 +27,9 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
+import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -82,6 +84,8 @@ public class UpdateExtensionDocPageMojo extends AbstractDocGeneratorMojo {
final Path multiModuleProjectDirectoryPath = multiModuleProjectDirectory.toPath();
final CamelQuarkusExtension ext = CamelQuarkusExtension.read(basePath.resolve("pom.xml"));
+ final Path quarkusAwsClienTestsDir = multiModuleProjectDirectoryPath
+ .resolve("integration-test-groups/aws2-quarkus-client");
final Path pomRelPath = multiModuleProjectDirectoryPath.relativize(basePath).resolve("pom.xml");
if (!ext.getJvmSince().isPresent()) {
@@ -134,6 +138,14 @@ public class UpdateExtensionDocPageMojo extends AbstractDocGeneratorMojo {
model.put("activatesTransferException",
ext.isNativeSupported()
&& detectComponentOrEndpointOption(catalog, ext.getRuntimeArtifactIdBase(), "transferException"));
+ model.put(
+ "quarkusAwsClient",
+ getQuarkusAwsClient(
+ quarkusAwsClienTestsDir,
+ ext.getRuntimeArtifactIdBase(),
+ ext.getQuarkusAwsClientBaseName(),
+ ext.getQuarkusAwsClientFqClassName(),
+ ext.getRuntimePomXmlPath()));
model.put("configOptions", listConfigOptions(basePath, multiModuleProjectDirectory.toPath()));
model.put("humanReadableKind", new TemplateMethodModelEx() {
@Override
@@ -304,6 +316,26 @@ public class UpdateExtensionDocPageMojo extends AbstractDocGeneratorMojo {
return false;
}
+ static QuarkusAwsClient getQuarkusAwsClient(Path quarkusAwsClienTestsDir, String artifactIdBase,
+ Optional<String> quarkusAwsClientBaseName, Optional<String> quarkusAwsClientFqClassName, Path runtimePomPath) {
+ if (quarkusAwsClientBaseName.isPresent() && quarkusAwsClientFqClassName.isPresent()) {
+ return new QuarkusAwsClient(quarkusAwsClientBaseName.get(), quarkusAwsClientFqClassName.get());
+ }
+ /* We assume Quarkus client exists if there is a test under integration-test-groups/aws2-quarkus-client */
+ final Path quarkusClientTestPath = quarkusAwsClienTestsDir.resolve(artifactIdBase + "/pom.xml");
+ if (Files.isRegularFile(quarkusClientTestPath)) {
+ if (!quarkusAwsClientBaseName.isPresent()) {
+ throw new IllegalStateException(quarkusClientTestPath
+ + " exists but cq.quarkus.aws.client.baseName propertly is not defined in " + runtimePomPath);
+ }
+ if (!quarkusAwsClientFqClassName.isPresent()) {
+ throw new IllegalStateException(quarkusClientTestPath
+ + " exists but cq.quarkus.aws.client.fqClassName propertly is not defined in " + runtimePomPath);
+ }
+ }
+ return null;
+ }
+
static boolean detectNativeSsl(Path deploymentBasePath) {
final Path deploymentPackageDir = deploymentBasePath.resolve("src/main/java/org/apache/camel/quarkus")
.toAbsolutePath()
@@ -418,6 +450,46 @@ public class UpdateExtensionDocPageMojo extends AbstractDocGeneratorMojo {
}
}
+ public static class QuarkusAwsClient {
+ public QuarkusAwsClient(String nameBase, String clientClassFqName) {
+ super();
+ this.nameBase = nameBase;
+ this.clientClassFqName = clientClassFqName;
+ }
+
+ private final String nameBase; // DynamoDB
+ private final String clientClassFqName; // software.amazon.awssdk.services.dynamodb.DynamoDbClient
+
+ public String getExtensionName() {
+ return "Quarkus Amazon " + nameBase;
+ }
+
+ public String getConfigurationUrl() {
+ String lowerCaseName = nameBase.toLowerCase(Locale.ROOT);
+ return "https://quarkus.io/guides/amazon-" + lowerCaseName + "#configuring-" + lowerCaseName + "-clients";
+ }
+
+ public String getConfigBase() {
+ return "quarkus." + nameBase.toLowerCase(Locale.ROOT);
+ }
+
+ public String getClientClassSimpleName() {
+ final int lastPeriod = clientClassFqName.lastIndexOf('.');
+ return clientClassFqName.substring(lastPeriod + 1);
+ }
+
+ public String getClientClassFqName() {
+ return clientClassFqName;
+ }
+
+ public String getClientFieldName() {
+ /* Just lowercase the first letter of getClientClassSimpleName() */
+ char c[] = getClientClassSimpleName().toCharArray();
+ c[0] += 32;
+ return new String(c);
+ }
+ }
+
public static class ConfigItem {
private static final Pattern LINK_PATTERN = Pattern
.compile("\\Qlink:http\\Es?\\Q://camel.apache.org/camel-quarkus/latest/\\E([^\\[]+).html");
diff --git a/tooling/maven-plugin/src/main/resources/doc-templates/extension-doc-page.adoc b/tooling/maven-plugin/src/main/resources/doc-templates/extension-doc-page.adoc
index 92c2e71..f6726fb 100644
--- a/tooling/maven-plugin/src/main/resources/doc-templates/extension-doc-page.adoc
+++ b/tooling/maven-plugin/src/main/resources/doc-templates/extension-doc-page.adoc
@@ -81,13 +81,45 @@ You will also need to enable serialization for the exception classes that you in
@RegisterForReflection(targets = { IllegalStateException.class, MyCustomException.class }, serialization = true)
----
[/#if]
-[#if configuration?? || configOptions?size != 0 ]
+[#if configuration?? || quarkusAwsClient?? || configOptions?size != 0 ]
== Additional Camel Quarkus configuration
[#if configuration??]
[=configuration]
[/#if]
+[#if quarkusAwsClient??]
+
+=== Optional integration with [=quarkusAwsClient.extensionName]
+
+If desired, it is possible to use the [=quarkusAwsClient.extensionName] extension in conjunction with Camel Quarkus [=name].
+Note that this is fully optional and not mandatory at all.
+Please follow the [=quarkusAwsClient.configurationUrl][Quarkus documentation] but beware of the following caveats:
+
+1. The client type `apache` has to be selected by configuring the following property:
++
+[source,properties]
+----
+[=quarkusAwsClient.configBase].sync-client.type=apache
+----
+
+2. The `[=quarkusAwsClient.clientClassSimpleName]` has to be made "unremovable" in the sense of https://quarkus.io/guides/cdi-reference#remove_unused_beans[Quarkus CDI reference] so that Camel Quarkus is able to look it up at runtime.
+You can reach that e.g. by adding a dummy bean injecting `[=quarkusAwsClient.clientClassSimpleName]`:
++
+[source,java]
+----
+import javax.enterprise.context.ApplicationScoped;
+import io.quarkus.arc.Unremovable;
+import [=quarkusAwsClient.clientClassFqName];
+
+@ApplicationScoped
+@Unremovable
+class Unremovable[=quarkusAwsClient.clientClassSimpleName] {
+ @Inject
+ [=quarkusAwsClient.clientClassSimpleName] [=quarkusAwsClient.clientFieldName];
+}
+----
+[/#if]
[#if configOptions?size != 0 ]
[width="100%",cols="80,5,15",options="header"]