From 049131a47a262d5ffdf40dbdc3ff8e2efc8373c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mathieu?= Date: Fri, 30 Oct 2020 18:24:02 +0100 Subject: [PATCH] Smallrye Reactive Messaging PubSub --- integration-tests/pom.xml | 1 + .../.gitignore | 36 +++++++ .../README.md | 28 +++++ .../pom.xml | 102 ++++++++++++++++++ .../pubsub/it/TestTopic.java | 12 +++ .../src/main/resources/application.properties | 6 ++ pom.xml | 1 + .../deployment/pom.xml | 54 ++++++++++ .../SmallryeReactiveMessagingPubsubSteps.java | 13 +++ smallrye-reactive-messaging-pubsub/pom.xml | 22 ++++ .../runtime/pom.xml | 82 ++++++++++++++ 11 files changed, 357 insertions(+) create mode 100644 integration-tests/smallrye-reactive-messaging-pubsub/.gitignore create mode 100644 integration-tests/smallrye-reactive-messaging-pubsub/README.md create mode 100644 integration-tests/smallrye-reactive-messaging-pubsub/pom.xml create mode 100644 integration-tests/smallrye-reactive-messaging-pubsub/src/main/java/io/quarkiverse/googlecloudservices/smallrye/reactivemessaging/pubsub/it/TestTopic.java create mode 100644 integration-tests/smallrye-reactive-messaging-pubsub/src/main/resources/application.properties create mode 100644 smallrye-reactive-messaging-pubsub/deployment/pom.xml create mode 100644 smallrye-reactive-messaging-pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/smallrye/reactivemessaging/pubsub/deployement/SmallryeReactiveMessagingPubsubSteps.java create mode 100644 smallrye-reactive-messaging-pubsub/pom.xml create mode 100644 smallrye-reactive-messaging-pubsub/runtime/pom.xml diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 24170145..af344949 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -19,6 +19,7 @@ main + smallrye-reactive-messaging-pubsub diff --git a/integration-tests/smallrye-reactive-messaging-pubsub/.gitignore b/integration-tests/smallrye-reactive-messaging-pubsub/.gitignore new file mode 100644 index 00000000..ba0565d1 --- /dev/null +++ b/integration-tests/smallrye-reactive-messaging-pubsub/.gitignore @@ -0,0 +1,36 @@ +#Maven +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +release.properties +# Eclipse +.project +.classpath +.settings/ +bin/ + +# IntelliJ +.idea +*.ipr +*.iml +*.iws + +# NetBeans +nb-configuration.xml + +# Visual Studio Code +.vscode +.factorypath + +# OSX +.DS_Store + +# Vim +*.swp +*.swo + +# patch +*.orig +*.rej + diff --git a/integration-tests/smallrye-reactive-messaging-pubsub/README.md b/integration-tests/smallrye-reactive-messaging-pubsub/README.md new file mode 100644 index 00000000..d9488518 --- /dev/null +++ b/integration-tests/smallrye-reactive-messaging-pubsub/README.md @@ -0,0 +1,28 @@ +# Quarkiverse - Google Cloud Services - Integration Tests - Smallrye Reactive Messaging PubSub + +**WARNING: this extension is experimental and rely on the experimental +[smallrye-reactive-messaging-gcp-pubsub](https://github.com/smallrye/smallrye-reactive-messaging/tree/master/smallrye-reactive-messaging-gcp-pubsub) +extension.** + +To test it you first need to create a topic named `test-topic` + +You can create one with `gcloud`: + +``` +gcloud pubsub topics create test-topic +``` + +As PubSub mandates the usage of the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to define its credentials, +you need to set this one instead of relying on the `quarkus.google.cloud.service-account-location` property. + +``` +export GOOGLE_APPLICATION_CREDENTIALS= +``` + +You can then use `gcloud` to send a message to the topic: + +``` +gcloud pubsub topics publish test-topic --message SGVsbG8gV29ybGQ= +``` + +NOTE: `SGVsbG8gV29ybGQ=` is `Hello World` in BASE64. \ No newline at end of file diff --git a/integration-tests/smallrye-reactive-messaging-pubsub/pom.xml b/integration-tests/smallrye-reactive-messaging-pubsub/pom.xml new file mode 100644 index 00000000..91587d56 --- /dev/null +++ b/integration-tests/smallrye-reactive-messaging-pubsub/pom.xml @@ -0,0 +1,102 @@ + + + + io.quarkiverse.googlecloudservices + quarkus-google-cloud-services-integration-tests-parent + 0.12.0-SNAPSHOT + ../pom.xml + + 4.0.0 + + quarkus-google-cloud-services-smallrye-reactive-messaging-pubsub-it + Quarkus - Google Cloud Services - Integration Tests - Smallrye Reactive messaging Pub/Sub + + + ${skipTests} + + + + + io.quarkiverse.googlecloudservices + smallrye-reactive-messaging-pubsub + 0.12.0-SNAPSHOT + + + io.quarkus + quarkus-arc + + + io.quarkus + quarkus-junit5 + test + + + + + + io.quarkus + quarkus-maven-plugin + ${quarkus.version} + + + + build + generate-code + generate-code-tests + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + + maven-surefire-plugin + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + native + + + native + + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + native + + + + diff --git a/integration-tests/smallrye-reactive-messaging-pubsub/src/main/java/io/quarkiverse/googlecloudservices/smallrye/reactivemessaging/pubsub/it/TestTopic.java b/integration-tests/smallrye-reactive-messaging-pubsub/src/main/java/io/quarkiverse/googlecloudservices/smallrye/reactivemessaging/pubsub/it/TestTopic.java new file mode 100644 index 00000000..9f1474b9 --- /dev/null +++ b/integration-tests/smallrye-reactive-messaging-pubsub/src/main/java/io/quarkiverse/googlecloudservices/smallrye/reactivemessaging/pubsub/it/TestTopic.java @@ -0,0 +1,12 @@ +package io.quarkiverse.googlecloudservices.smallrye.reactivemessaging.pubsub.it; + +import java.util.Base64; + +import org.eclipse.microprofile.reactive.messaging.Incoming; + +public class TestTopic { + @Incoming("my-topic") + public void test(String str) { + System.out.println("Receive => " + new String(Base64.getDecoder().decode(str))); + } +} diff --git a/integration-tests/smallrye-reactive-messaging-pubsub/src/main/resources/application.properties b/integration-tests/smallrye-reactive-messaging-pubsub/src/main/resources/application.properties new file mode 100644 index 00000000..6b45e1ef --- /dev/null +++ b/integration-tests/smallrye-reactive-messaging-pubsub/src/main/resources/application.properties @@ -0,0 +1,6 @@ +gcp-pubsub-project-id=test-project + +# Google Cloud Pub/Sub source (we read from it) +mp.messaging.incoming.my-topic.connector=smallrye-gcp-pubsub +mp.messaging.incoming.my-topic.topic=test-topic +mp.messaging.incoming.my-topic.subscription=test-topic \ No newline at end of file diff --git a/pom.xml b/pom.xml index 0fa85eef..629d8ec5 100644 --- a/pom.xml +++ b/pom.xml @@ -35,6 +35,7 @@ firestore bigtable secret-manager + smallrye-reactive-messaging-pubsub integration-tests diff --git a/smallrye-reactive-messaging-pubsub/deployment/pom.xml b/smallrye-reactive-messaging-pubsub/deployment/pom.xml new file mode 100644 index 00000000..3f795b0a --- /dev/null +++ b/smallrye-reactive-messaging-pubsub/deployment/pom.xml @@ -0,0 +1,54 @@ + + + + io.quarkiverse.googlecloudservices + quarkus-smallrye-reactive-messaging-pubsub-parent + 0.12.0-SNAPSHOT + ../pom.xml + + 4.0.0 + + smallrye-reactive-messaging-pubsub-deployment + Quarkus - Google Cloud Services - Smallrye Reactive Messaging PubSub - Deployment + + + + io.quarkus + quarkus-core-deployment + + + io.quarkiverse.googlecloudservices + quarkus-google-cloud-pubsub-deployment + 0.12.0-SNAPSHOT + + + io.quarkiverse.googlecloudservices + smallrye-reactive-messaging-pubsub + 0.12.0-SNAPSHOT + + + io.quarkus + quarkus-smallrye-reactive-messaging-deployment + + + + + + + maven-compiler-plugin + + + + io.quarkus + quarkus-extension-processor + ${quarkus.version} + + + + + + + + \ No newline at end of file diff --git a/smallrye-reactive-messaging-pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/smallrye/reactivemessaging/pubsub/deployement/SmallryeReactiveMessagingPubsubSteps.java b/smallrye-reactive-messaging-pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/smallrye/reactivemessaging/pubsub/deployement/SmallryeReactiveMessagingPubsubSteps.java new file mode 100644 index 00000000..a1c48195 --- /dev/null +++ b/smallrye-reactive-messaging-pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/smallrye/reactivemessaging/pubsub/deployement/SmallryeReactiveMessagingPubsubSteps.java @@ -0,0 +1,13 @@ +package io.quarkiverse.googlecloudservices.smallrye.reactivemessaging.pubsub.deployement; + +import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.builditem.FeatureBuildItem; + +public class SmallryeReactiveMessagingPubsubSteps { + private static final String FEATURE = "smallrye-reactive-messaging-pubsub"; + + @BuildStep + public FeatureBuildItem feature() { + return new FeatureBuildItem(FEATURE); + } +} diff --git a/smallrye-reactive-messaging-pubsub/pom.xml b/smallrye-reactive-messaging-pubsub/pom.xml new file mode 100644 index 00000000..5e858a81 --- /dev/null +++ b/smallrye-reactive-messaging-pubsub/pom.xml @@ -0,0 +1,22 @@ + + + + io.quarkiverse.googlecloudservices + quarkus-google-cloud-services-parent + 0.12.0-SNAPSHOT + ../pom.xml + + 4.0.0 + + quarkus-smallrye-reactive-messaging-pubsub-parent + Quarkus - Google Cloud Services - Smallrye Reactive Messaging PubSub + pom + + + runtime + deployment + + + \ No newline at end of file diff --git a/smallrye-reactive-messaging-pubsub/runtime/pom.xml b/smallrye-reactive-messaging-pubsub/runtime/pom.xml new file mode 100644 index 00000000..9bda2b0e --- /dev/null +++ b/smallrye-reactive-messaging-pubsub/runtime/pom.xml @@ -0,0 +1,82 @@ + + + + io.quarkiverse.googlecloudservices + quarkus-smallrye-reactive-messaging-pubsub-parent + 0.12.0-SNAPSHOT + ../pom.xml + + 4.0.0 + + smallrye-reactive-messaging-pubsub + Quarkus - Google Cloud Services - Smallrye Reactive Messaging PubSub - Runtime + Connect to PubSub with Reactive Messaging + + + + io.quarkiverse.googlecloudservices + quarkus-google-cloud-pubsub + 0.12.0-SNAPSHOT + + + io.smallrye.reactive + smallrye-reactive-messaging-gcp-pubsub + 3.13.0 + + + io.quarkus + quarkus-smallrye-reactive-messaging + + + io.smallrye.reactive + smallrye-reactive-messaging-provider + + + com.fasterxml.jackson.core + jackson-core + + + javax.annotation + javax.annotation-api + + + + + + + + + io.quarkus + quarkus-bootstrap-maven-plugin + ${quarkus.version} + + + + extension-descriptor + + compile + + ${project.groupId}:${project.artifactId}-deployment:${project.version} + + + + + + + maven-compiler-plugin + + + + io.quarkus + quarkus-extension-processor + ${quarkus.version} + + + + + + + + \ No newline at end of file