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

Smallrye Reactive Messaging PubSub #55

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<!-- Only the main IT here, other will be added via profile to avoid running them while deploying -->
<modules>
<module>main</module>
<module>smallrye-reactive-messaging-pubsub</module>
</modules>

<profiles>
Expand Down
36 changes: 36 additions & 0 deletions integration-tests/smallrye-reactive-messaging-pubsub/.gitignore
Original file line number Diff line number Diff line change
@@ -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

28 changes: 28 additions & 0 deletions integration-tests/smallrye-reactive-messaging-pubsub/README.md
Original file line number Diff line number Diff line change
@@ -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=<your-service-account-file>
```

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.
102 changes: 102 additions & 0 deletions integration-tests/smallrye-reactive-messaging-pubsub/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<parent>
<groupId>io.quarkiverse.googlecloudservices</groupId>
<artifactId>quarkus-google-cloud-services-integration-tests-parent</artifactId>
<version>0.12.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-google-cloud-services-smallrye-reactive-messaging-pubsub-it</artifactId>
<name>Quarkus - Google Cloud Services - Integration Tests - Smallrye Reactive messaging Pub/Sub</name>

<properties>
<native.surefire.skip>${skipTests}</native.surefire.skip>
</properties>

<dependencies>
<dependency>
<groupId>io.quarkiverse.googlecloudservices</groupId>
<artifactId>smallrye-reactive-messaging-pubsub</artifactId>
<version>0.12.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.version}</version>
<executions>
<execution>
<goals>
<goal>build</goal>
<goal>generate-code</goal>
<goal>generate-code-tests</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<systemPropertyVariables>
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<quarkus.package.type>native</quarkus.package.type>
</properties>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -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)));
}
}
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<module>firestore</module>
<module>bigtable</module>
<module>secret-manager</module>
<module>smallrye-reactive-messaging-pubsub</module>
<module>integration-tests</module>
</modules>

Expand Down
54 changes: 54 additions & 0 deletions smallrye-reactive-messaging-pubsub/deployment/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?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">
<parent>
<groupId>io.quarkiverse.googlecloudservices</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-pubsub-parent</artifactId>
<version>0.12.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>smallrye-reactive-messaging-pubsub-deployment</artifactId>
<name>Quarkus - Google Cloud Services - Smallrye Reactive Messaging PubSub - Deployment</name>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.googlecloudservices</groupId>
<artifactId>quarkus-google-cloud-pubsub-deployment</artifactId>
<version>0.12.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.googlecloudservices</groupId>
<artifactId>smallrye-reactive-messaging-pubsub</artifactId>
<version>0.12.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-deployment</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<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>
Original file line number Diff line number Diff line change
@@ -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);
}
}
22 changes: 22 additions & 0 deletions smallrye-reactive-messaging-pubsub/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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">
<parent>
<groupId>io.quarkiverse.googlecloudservices</groupId>
<artifactId>quarkus-google-cloud-services-parent</artifactId>
<version>0.12.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-smallrye-reactive-messaging-pubsub-parent</artifactId>
<name>Quarkus - Google Cloud Services - Smallrye Reactive Messaging PubSub</name>
<packaging>pom</packaging>

<modules>
<module>runtime</module>
<module>deployment</module>
</modules>

</project>
82 changes: 82 additions & 0 deletions smallrye-reactive-messaging-pubsub/runtime/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?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">
<parent>
<groupId>io.quarkiverse.googlecloudservices</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-pubsub-parent</artifactId>
<version>0.12.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>smallrye-reactive-messaging-pubsub</artifactId>
<name>Quarkus - Google Cloud Services - Smallrye Reactive Messaging PubSub - Runtime</name>
<description>Connect to PubSub with Reactive Messaging</description>

<dependencies>
<dependency>
<groupId>io.quarkiverse.googlecloudservices</groupId>
<artifactId>quarkus-google-cloud-pubsub</artifactId>
<version>0.12.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-reactive-messaging-gcp-pubsub</artifactId>
<version>3.13.0</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-reactive-messaging-provider</artifactId>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
<exclusion>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bootstrap-maven-plugin</artifactId>
<version>${quarkus.version}</version>
<executions>
<execution>
<goals>
<goal>extension-descriptor</goal>
</goals>
<phase>compile</phase>
<configuration>
<deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}
</deployment>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<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>