Skip to content

Commit d67d8c5

Browse files
committed
Smallrye Reactive Messaging PubSub
1 parent ffb9020 commit d67d8c5

File tree

11 files changed

+357
-0
lines changed

11 files changed

+357
-0
lines changed

integration-tests/pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<!-- Only the main IT here, other will be added via profile to avoid running them while deploying -->
2020
<modules>
2121
<module>main</module>
22+
<module>smallrye-reactive-messaging-pubsub</module>
2223
</modules>
2324

2425
<profiles>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#Maven
2+
target/
3+
pom.xml.tag
4+
pom.xml.releaseBackup
5+
pom.xml.versionsBackup
6+
release.properties
7+
# Eclipse
8+
.project
9+
.classpath
10+
.settings/
11+
bin/
12+
13+
# IntelliJ
14+
.idea
15+
*.ipr
16+
*.iml
17+
*.iws
18+
19+
# NetBeans
20+
nb-configuration.xml
21+
22+
# Visual Studio Code
23+
.vscode
24+
.factorypath
25+
26+
# OSX
27+
.DS_Store
28+
29+
# Vim
30+
*.swp
31+
*.swo
32+
33+
# patch
34+
*.orig
35+
*.rej
36+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Quarkiverse - Google Cloud Services - Integration Tests - Smallrye Reactive Messaging PubSub
2+
3+
**WARNING: this extension is experimental and rely on the experimental
4+
[smallrye-reactive-messaging-gcp-pubsub](https://github.com/smallrye/smallrye-reactive-messaging/tree/master/smallrye-reactive-messaging-gcp-pubsub)
5+
extension.**
6+
7+
To test it you first need to create a topic named `test-topic`
8+
9+
You can create one with `gcloud`:
10+
11+
```
12+
gcloud pubsub topics create test-topic
13+
```
14+
15+
As PubSub mandates the usage of the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to define its credentials,
16+
you need to set this one instead of relying on the `quarkus.google.cloud.service-account-location` property.
17+
18+
```
19+
export GOOGLE_APPLICATION_CREDENTIALS=<your-service-account-file>
20+
```
21+
22+
You can then use `gcloud` to send a message to the topic:
23+
24+
```
25+
gcloud pubsub topics publish test-topic --message SGVsbG8gV29ybGQ=
26+
```
27+
28+
NOTE: `SGVsbG8gV29ybGQ=` is `Hello World` in BASE64.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<?xml version="1.0"?>
2+
<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"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<parent>
5+
<groupId>io.quarkiverse.googlecloudservices</groupId>
6+
<artifactId>quarkus-google-cloud-services-integration-tests-parent</artifactId>
7+
<version>0.12.0-SNAPSHOT</version>
8+
<relativePath>../pom.xml</relativePath>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>quarkus-google-cloud-services-smallrye-reactive-messaging-pubsub-it</artifactId>
13+
<name>Quarkus - Google Cloud Services - Integration Tests - Smallrye Reactive messaging Pub/Sub</name>
14+
15+
<properties>
16+
<native.surefire.skip>${skipTests}</native.surefire.skip>
17+
</properties>
18+
19+
<dependencies>
20+
<dependency>
21+
<groupId>io.quarkiverse.googlecloudservices</groupId>
22+
<artifactId>smallrye-reactive-messaging-pubsub</artifactId>
23+
<version>0.12.0-SNAPSHOT</version>
24+
</dependency>
25+
<dependency>
26+
<groupId>io.quarkus</groupId>
27+
<artifactId>quarkus-arc</artifactId>
28+
</dependency>
29+
<dependency>
30+
<groupId>io.quarkus</groupId>
31+
<artifactId>quarkus-junit5</artifactId>
32+
<scope>test</scope>
33+
</dependency>
34+
</dependencies>
35+
<build>
36+
<plugins>
37+
<plugin>
38+
<groupId>io.quarkus</groupId>
39+
<artifactId>quarkus-maven-plugin</artifactId>
40+
<version>${quarkus.version}</version>
41+
<executions>
42+
<execution>
43+
<goals>
44+
<goal>build</goal>
45+
<goal>generate-code</goal>
46+
<goal>generate-code-tests</goal>
47+
</goals>
48+
</execution>
49+
</executions>
50+
</plugin>
51+
<plugin>
52+
<artifactId>maven-compiler-plugin</artifactId>
53+
<version>${compiler-plugin.version}</version>
54+
</plugin>
55+
<plugin>
56+
<artifactId>maven-surefire-plugin</artifactId>
57+
<configuration>
58+
<systemPropertyVariables>
59+
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
60+
<maven.home>${maven.home}</maven.home>
61+
</systemPropertyVariables>
62+
</configuration>
63+
</plugin>
64+
</plugins>
65+
</build>
66+
<profiles>
67+
<profile>
68+
<id>native</id>
69+
<activation>
70+
<property>
71+
<name>native</name>
72+
</property>
73+
</activation>
74+
<build>
75+
<plugins>
76+
<plugin>
77+
<artifactId>maven-failsafe-plugin</artifactId>
78+
<version>${surefire-plugin.version}</version>
79+
<executions>
80+
<execution>
81+
<goals>
82+
<goal>integration-test</goal>
83+
<goal>verify</goal>
84+
</goals>
85+
<configuration>
86+
<systemPropertyVariables>
87+
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
88+
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
89+
<maven.home>${maven.home}</maven.home>
90+
</systemPropertyVariables>
91+
</configuration>
92+
</execution>
93+
</executions>
94+
</plugin>
95+
</plugins>
96+
</build>
97+
<properties>
98+
<quarkus.package.type>native</quarkus.package.type>
99+
</properties>
100+
</profile>
101+
</profiles>
102+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package io.quarkiverse.googlecloudservices.smallrye.reactivemessaging.pubsub.it;
2+
3+
import java.util.Base64;
4+
5+
import org.eclipse.microprofile.reactive.messaging.Incoming;
6+
7+
public class TestTopic {
8+
@Incoming("my-topic")
9+
public void test(String str) {
10+
System.out.println("Receive => " + new String(Base64.getDecoder().decode(str)));
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
gcp-pubsub-project-id=my-project-id
2+
3+
# Google Cloud Pub/Sub source (we read from it)
4+
smallrye.messaging.source.my-topic.connector=smallrye-gcp-pubsub
5+
smallrye.messaging.source.my-topic.topic=test-topic
6+
smallrye.messaging.source.my-topic.subscription=test-topic

pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<module>firestore</module>
3636
<module>bigtable</module>
3737
<module>secret-manager</module>
38+
<module>smallrye-reactive-messaging-pubsub</module>
3839
<module>integration-tests</module>
3940
</modules>
4041

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<groupId>io.quarkiverse.googlecloudservices</groupId>
7+
<artifactId>quarkus-smallrye-reactive-messaging-pubsub-parent</artifactId>
8+
<version>0.12.0-SNAPSHOT</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
<modelVersion>4.0.0</modelVersion>
12+
13+
<artifactId>smallrye-reactive-messaging-pubsub-deployment</artifactId>
14+
<name>Quarkus - Google Cloud Services - Smallrye Reactive Messaging PubSub - Deployment</name>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>io.quarkus</groupId>
19+
<artifactId>quarkus-core-deployment</artifactId>
20+
</dependency>
21+
<dependency>
22+
<groupId>io.quarkiverse.googlecloudservices</groupId>
23+
<artifactId>quarkus-google-cloud-pubsub-deployment</artifactId>
24+
<version>0.12.0-SNAPSHOT</version>
25+
</dependency>
26+
<dependency>
27+
<groupId>io.quarkiverse.googlecloudservices</groupId>
28+
<artifactId>smallrye-reactive-messaging-pubsub</artifactId>
29+
<version>0.12.0-SNAPSHOT</version>
30+
</dependency>
31+
<dependency>
32+
<groupId>io.quarkus</groupId>
33+
<artifactId>quarkus-smallrye-reactive-messaging-deployment</artifactId>
34+
</dependency>
35+
</dependencies>
36+
37+
<build>
38+
<plugins>
39+
<plugin>
40+
<artifactId>maven-compiler-plugin</artifactId>
41+
<configuration>
42+
<annotationProcessorPaths>
43+
<path>
44+
<groupId>io.quarkus</groupId>
45+
<artifactId>quarkus-extension-processor</artifactId>
46+
<version>${quarkus.version}</version>
47+
</path>
48+
</annotationProcessorPaths>
49+
</configuration>
50+
</plugin>
51+
</plugins>
52+
</build>
53+
54+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package io.quarkiverse.googlecloudservices.smallrye.reactivemessaging.pubsub.deployement;
2+
3+
import io.quarkus.deployment.annotations.BuildStep;
4+
import io.quarkus.deployment.builditem.FeatureBuildItem;
5+
6+
public class SmallryeReactiveMessagingPubsubSteps {
7+
private static final String FEATURE = "smallrye-reactive-messaging-pubsub";
8+
9+
@BuildStep
10+
public FeatureBuildItem feature() {
11+
return new FeatureBuildItem(FEATURE);
12+
}
13+
}
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<groupId>io.quarkiverse.googlecloudservices</groupId>
7+
<artifactId>quarkus-google-cloud-services-parent</artifactId>
8+
<version>0.12.0-SNAPSHOT</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
<modelVersion>4.0.0</modelVersion>
12+
13+
<artifactId>quarkus-smallrye-reactive-messaging-pubsub-parent</artifactId>
14+
<name>Quarkus - Google Cloud Services - Smallrye Reactive Messaging PubSub</name>
15+
<packaging>pom</packaging>
16+
17+
<modules>
18+
<module>runtime</module>
19+
<module>deployment</module>
20+
</modules>
21+
22+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<groupId>io.quarkiverse.googlecloudservices</groupId>
7+
<artifactId>quarkus-smallrye-reactive-messaging-pubsub-parent</artifactId>
8+
<version>0.12.0-SNAPSHOT</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
<modelVersion>4.0.0</modelVersion>
12+
13+
<artifactId>smallrye-reactive-messaging-pubsub</artifactId>
14+
<name>Quarkus - Google Cloud Services - Smallrye Reactive Messaging PubSub - Runtime</name>
15+
<description>Connect to PubSub with Reactive Messaging</description>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>io.quarkiverse.googlecloudservices</groupId>
20+
<artifactId>quarkus-google-cloud-pubsub</artifactId>
21+
<version>0.12.0-SNAPSHOT</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>io.smallrye.reactive</groupId>
25+
<artifactId>smallrye-reactive-messaging-gcp-pubsub</artifactId>
26+
<version>3.13.0</version>
27+
</dependency>
28+
<dependency>
29+
<groupId>io.quarkus</groupId>
30+
<artifactId>quarkus-smallrye-reactive-messaging</artifactId>
31+
</dependency>
32+
<dependency>
33+
<groupId>io.smallrye.reactive</groupId>
34+
<artifactId>smallrye-reactive-messaging-provider</artifactId>
35+
<exclusions>
36+
<exclusion>
37+
<groupId>com.fasterxml.jackson.core</groupId>
38+
<artifactId>jackson-core</artifactId>
39+
</exclusion>
40+
<exclusion>
41+
<groupId>javax.annotation</groupId>
42+
<artifactId>javax.annotation-api</artifactId>
43+
</exclusion>
44+
</exclusions>
45+
</dependency>
46+
</dependencies>
47+
48+
<build>
49+
<plugins>
50+
<plugin>
51+
<groupId>io.quarkus</groupId>
52+
<artifactId>quarkus-bootstrap-maven-plugin</artifactId>
53+
<version>${quarkus.version}</version>
54+
<executions>
55+
<execution>
56+
<goals>
57+
<goal>extension-descriptor</goal>
58+
</goals>
59+
<phase>compile</phase>
60+
<configuration>
61+
<deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}
62+
</deployment>
63+
</configuration>
64+
</execution>
65+
</executions>
66+
</plugin>
67+
<plugin>
68+
<artifactId>maven-compiler-plugin</artifactId>
69+
<configuration>
70+
<annotationProcessorPaths>
71+
<path>
72+
<groupId>io.quarkus</groupId>
73+
<artifactId>quarkus-extension-processor</artifactId>
74+
<version>${quarkus.version}</version>
75+
</path>
76+
</annotationProcessorPaths>
77+
</configuration>
78+
</plugin>
79+
</plugins>
80+
</build>
81+
82+
</project>

0 commit comments

Comments
 (0)