-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Maven archetype for creating a new connector
- Loading branch information
1 parent
d4ca378
commit 0f57e11
Showing
29 changed files
with
1,417 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.smallrye.reactive</groupId> | ||
<artifactId>smallrye-reactive-messaging</artifactId> | ||
<version>4.11.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>smallrye-reactive-messaging-connector-archetype</artifactId> | ||
|
||
<name>SmallRye Reactive Messaging : Connector Archetype</name> | ||
<packaging>maven-archetype</packaging> | ||
|
||
<properties> | ||
<jandex.skip>true</jandex.skip> | ||
<archetype.test.skip>${skipTests}</archetype.test.skip> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.smallrye.reactive</groupId> | ||
<artifactId>smallrye-reactive-messaging-provider</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.smallrye.reactive</groupId> | ||
<artifactId>smallrye-reactive-messaging-otel</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.smallrye.reactive</groupId> | ||
<artifactId>smallrye-connector-attribute-processor</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<extensions> | ||
<extension> | ||
<groupId>org.apache.maven.archetype</groupId> | ||
<artifactId>archetype-packaging</artifactId> | ||
<version>3.2.1</version> | ||
</extension> | ||
</extensions> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<filtering>true</filtering> | ||
<includes> | ||
<include>archetype-resources/pom.xml</include> | ||
</includes> | ||
</resource> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<filtering>false</filtering> | ||
<excludes> | ||
<exclude>archetype-resources/pom.xml</exclude> | ||
</excludes> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
<configuration> | ||
<escapeString>\</escapeString> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-archetype-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
47 changes: 47 additions & 0 deletions
47
...ve-messaging-connector-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- | ||
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 | ||
https://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. | ||
--> | ||
|
||
<archetype-descriptor | ||
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" | ||
name="${artifactId}"> | ||
<requiredProperties> | ||
<requiredProperty key="connectorName"> | ||
<defaultValue> | ||
my | ||
</defaultValue> | ||
</requiredProperty> | ||
<requiredProperty key="connectorPrefix"> | ||
<defaultValue> | ||
${package.getClass().forName("org.apache.velocity.util.StringUtils").removeAndHump("$connectorName", "-")} | ||
</defaultValue> | ||
</requiredProperty> | ||
</requiredProperties> | ||
<fileSets> | ||
<fileSet filtered="true" packaged="true"> | ||
<directory>src/main/java</directory> | ||
</fileSet> | ||
<fileSet filtered="true" packaged="true"> | ||
<directory>src/test/java</directory> | ||
</fileSet> | ||
</fileSets> | ||
</archetype-descriptor> |
154 changes: 154 additions & 0 deletions
154
...rye-reactive-messaging-connector-archetype/src/main/resources/archetype-resources/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
<?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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.smallrye.reactive</groupId> | ||
<artifactId>smallrye-reactive-messaging</artifactId> | ||
<version>${project.version}</version> | ||
</parent> | ||
|
||
<groupId>\${groupId}</groupId> | ||
<artifactId>\${artifactId}</artifactId> | ||
<version>\${version}</version> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.smallrye.reactive</groupId> | ||
<artifactId>smallrye-reactive-messaging-provider</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>javax.annotation</groupId> | ||
<artifactId>javax.annotation-api</artifactId> | ||
<scope>test</scope> | ||
<version>1.3.2</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.smallrye.reactive</groupId> | ||
<artifactId>smallrye-reactive-messaging-otel</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.smallrye.config</groupId> | ||
<artifactId>smallrye-config</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.smallrye</groupId> | ||
<artifactId>smallrye-fault-tolerance</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.smallrye</groupId> | ||
<artifactId>smallrye-metrics</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.smallrye.reactive</groupId> | ||
<artifactId>test-common</artifactId> | ||
<version>\${project.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.opentelemetry</groupId> | ||
<artifactId>opentelemetry-sdk-trace</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.opentelemetry</groupId> | ||
<artifactId>opentelemetry-sdk-testing</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.smallrye.reactive</groupId> | ||
<artifactId>smallrye-connector-attribute-processor</artifactId> | ||
<version>\${project.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testcontainers</groupId> | ||
<artifactId>testcontainers</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.smallrye.reactive</groupId> | ||
<artifactId>mutiny-zero-reactive-streams-junit5-tck</artifactId> | ||
<version>\${mutiny-zero.version}</version> | ||
<scope>test</scope> | ||
<classifier>tests</classifier> | ||
</dependency> | ||
|
||
<!-- Ensure log4j1 log backend with slf4j --> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<generatedSourcesDirectory>\${project.build.directory}/generated-sources/</generatedSourcesDirectory> | ||
<annotationProcessors> | ||
<annotationProcessor> | ||
io.smallrye.reactive.messaging.connector.ConnectorAttributeProcessor | ||
</annotationProcessor> | ||
<annotationProcessor> | ||
org.jboss.logging.processor.apt.LoggingToolsProcessor | ||
</annotationProcessor> | ||
</annotationProcessors> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>default-test</id> | ||
<goals> | ||
<goal>test</goal> | ||
</goals> | ||
<configuration> | ||
<!-- Disable TestNG --> | ||
<testNGArtifactName>none:none</testNGArtifactName> | ||
<reuseForks>true</reuseForks> | ||
<systemPropertyVariables> | ||
<org.jboss.logging.provider>slf4j</org.jboss.logging.provider> | ||
</systemPropertyVariables> | ||
<argLine>--add-opens=java.base/sun.net=ALL-UNNAMED</argLine> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>coverage</id> | ||
<properties> | ||
<argLine>@{jacocoArgLine}</argLine> | ||
</properties> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.jacoco</groupId> | ||
<artifactId>jacoco-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
|
||
</project> |
25 changes: 25 additions & 0 deletions
25
...e/src/main/resources/archetype-resources/src/main/java/__connectorPrefix__AckHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package ${package}; | ||
|
||
import java.util.concurrent.CompletionStage; | ||
|
||
import ${package}.api.BrokerClient; | ||
import io.smallrye.mutiny.Uni; | ||
|
||
public class ${connectorPrefix}AckHandler { | ||
|
||
private final BrokerClient client; | ||
|
||
static ${connectorPrefix}AckHandler create(BrokerClient client) { | ||
return new ${connectorPrefix}AckHandler(client); | ||
} | ||
|
||
public ${connectorPrefix}AckHandler(BrokerClient client) { | ||
this.client = client; | ||
} | ||
|
||
public CompletionStage<Void> handle(${connectorPrefix}Message<?> msg) { | ||
return Uni.createFrom().completionStage(client.ack(msg.getConsumedMessage())) | ||
.emitOn(msg::runOnMessageContext) | ||
.subscribeAsCompletionStage(); | ||
} | ||
} |
Oops, something went wrong.