Skip to content

Commit

Permalink
Merge pull request #977 from stuartwdouglas/kafka
Browse files Browse the repository at this point in the history
Add Kafka and Kafka Reactive Messaging extensions
  • Loading branch information
stuartwdouglas authored Feb 21, 2019
2 parents 6ffdf72 + b2f4e44 commit a4e7ab2
Show file tree
Hide file tree
Showing 21 changed files with 913 additions and 0 deletions.
13 changes: 13 additions & 0 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.jboss.shamrock</groupId>
<artifactId>shamrock-kafka-client-deployment</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.jboss.shamrock</groupId>
<artifactId>shamrock-smallrye-health-deployment</artifactId>
Expand Down Expand Up @@ -101,6 +108,12 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.shamrock</groupId>
<artifactId>shamrock-smallrye-reactive-messaging-kafka-deployment</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.jboss.shamrock</groupId>
Expand Down
70 changes: 70 additions & 0 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@
<test-containers.version>1.10.6</test-containers.version>
<jboss-logging.version>3.3.2.Final</jboss-logging.version>
<vertx-axle-client.version>0.0.1</vertx-axle-client.version>
<kafka-clients.version>1.1.0</kafka-clients.version>
<kafka2.version>1.1.0</kafka2.version>
<debezium.version>0.8.3.Final</debezium.version>
<zookeeper.version>3.4.10</zookeeper.version>
<scala.version>2.12.2</scala.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -229,6 +234,16 @@
<artifactId>shamrock-jdbc-mariadb-runtime</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.shamrock</groupId>
<artifactId>shamrock-kafka-client-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.shamrock</groupId>
<artifactId>shamrock-kafka-client-runtime</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.shamrock</groupId>
<artifactId>shamrock-smallrye-health-deployment</artifactId>
Expand Down Expand Up @@ -513,6 +528,16 @@
<artifactId>shamrock-smallrye-reactive-messaging-runtime</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.shamrock</groupId>
<artifactId>shamrock-smallrye-reactive-messaging-kafka-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.shamrock</groupId>
<artifactId>shamrock-smallrye-reactive-messaging-kafka-runtime</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.shamrock</groupId>
<artifactId>shamrock-spring-di-deployment</artifactId>
Expand Down Expand Up @@ -618,6 +643,11 @@
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>jakarta.activation</artifactId>
Expand Down Expand Up @@ -707,6 +737,30 @@
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>io.debezium</groupId>
<artifactId>debezium-core</artifactId>
<version>${debezium.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.debezium</groupId>
<artifactId>debezium-core</artifactId>
<version>${debezium.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-reflect</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-servlet</artifactId>
Expand Down Expand Up @@ -858,6 +912,22 @@
<artifactId>httpcore</artifactId>
<version>${httpcore.version}</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>${kafka-clients.version}</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.12</artifactId>
<version>${kafka2.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>${zookeeper.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
Expand Down
47 changes: 47 additions & 0 deletions extensions/kafka-client/deployment/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?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>org.jboss.shamrock</groupId>
<artifactId>shamrock-kafka-client</artifactId>
<version>1.0.0.Alpha1-SNAPSHOT</version>
</parent>

<artifactId>shamrock-kafka-client-deployment</artifactId>

<dependencies>
<dependency>
<groupId>org.jboss.shamrock</groupId>
<artifactId>shamrock-core-deployment</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.shamrock</groupId>
<artifactId>shamrock-kafka-client-runtime</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.shamrock</groupId>
<artifactId>shamrock-junit5-internal</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.jboss.shamrock</groupId>
<artifactId>shamrock-extension-processor</artifactId>
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package org.jboss.shamrock.kafka;

import java.util.Arrays;
import java.util.Collection;

import org.apache.kafka.clients.consumer.RangeAssignor;
import org.apache.kafka.clients.consumer.RoundRobinAssignor;
import org.apache.kafka.clients.consumer.StickyAssignor;
import org.apache.kafka.clients.consumer.internals.PartitionAssignor;
import org.apache.kafka.clients.producer.Partitioner;
import org.apache.kafka.clients.producer.internals.DefaultPartitioner;
import org.apache.kafka.common.serialization.ByteArrayDeserializer;
import org.apache.kafka.common.serialization.ByteArraySerializer;
import org.apache.kafka.common.serialization.ByteBufferDeserializer;
import org.apache.kafka.common.serialization.ByteBufferSerializer;
import org.apache.kafka.common.serialization.BytesDeserializer;
import org.apache.kafka.common.serialization.BytesSerializer;
import org.apache.kafka.common.serialization.Deserializer;
import org.apache.kafka.common.serialization.DoubleDeserializer;
import org.apache.kafka.common.serialization.DoubleSerializer;
import org.apache.kafka.common.serialization.FloatDeserializer;
import org.apache.kafka.common.serialization.FloatSerializer;
import org.apache.kafka.common.serialization.IntegerDeserializer;
import org.apache.kafka.common.serialization.IntegerSerializer;
import org.apache.kafka.common.serialization.LongDeserializer;
import org.apache.kafka.common.serialization.LongSerializer;
import org.apache.kafka.common.serialization.Serializer;
import org.apache.kafka.common.serialization.ShortDeserializer;
import org.apache.kafka.common.serialization.ShortSerializer;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.apache.kafka.common.serialization.StringSerializer;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;
import org.jboss.shamrock.deployment.annotations.BuildProducer;
import org.jboss.shamrock.deployment.annotations.BuildStep;
import org.jboss.shamrock.deployment.builditem.CombinedIndexBuildItem;
import org.jboss.shamrock.deployment.builditem.substrate.ReflectiveClassBuildItem;

public class KafkaProcessor {

static final Class[] BUILT_INS = {
//serializers
ShortSerializer.class,
DoubleSerializer.class,
LongSerializer.class,
BytesSerializer.class,
ByteArraySerializer.class,
IntegerSerializer.class,
ByteBufferSerializer.class,
StringSerializer.class,
FloatSerializer.class,

//deserializers
ShortDeserializer.class,
DoubleDeserializer.class,
LongDeserializer.class,
BytesDeserializer.class,
ByteArrayDeserializer.class,
IntegerDeserializer.class,
ByteBufferDeserializer.class,
StringDeserializer.class,
FloatDeserializer.class,
};

@BuildStep
public void build(CombinedIndexBuildItem indexBuildItem, BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
Collection<ClassInfo> serializers = indexBuildItem.getIndex()
.getAllKnownSubclasses(DotName.createSimple(Serializer.class.getName()));
Collection<ClassInfo> deserializers = indexBuildItem.getIndex()
.getAllKnownSubclasses(DotName.createSimple(Deserializer.class.getName()));
Collection<ClassInfo> partitioners = indexBuildItem.getIndex()
.getAllKnownSubclasses(DotName.createSimple(Partitioner.class.getName()));
Collection<ClassInfo> partitionAssignors = indexBuildItem.getIndex()
.getAllKnownSubclasses(DotName.createSimple(PartitionAssignor.class.getName()));

for (Class i : BUILT_INS) {
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, i.getName()));
}

for (Collection<ClassInfo> list : Arrays.asList(serializers, deserializers, partitioners, partitionAssignors)) {
for (ClassInfo s : list) {
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, s.toString()));
}
}

// built in partitioner and partition assignors
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, DefaultPartitioner.class.getName()));
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, RangeAssignor.class.getName()));
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, RoundRobinAssignor.class.getName()));
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, StickyAssignor.class.getName()));

}
}
21 changes: 21 additions & 0 deletions extensions/kafka-client/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?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>
<artifactId>shamrock-build-parent</artifactId>
<groupId>org.jboss.shamrock</groupId>
<version>1.0.0.Alpha1-SNAPSHOT</version>
<relativePath>../../build-parent/pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>shamrock-kafka-client</artifactId>
<name>Shamrock - Kafka - Client</name>
<packaging>pom</packaging>

<modules>
<module>deployment</module>
<module>runtime</module>
</modules>
</project>
50 changes: 50 additions & 0 deletions extensions/kafka-client/runtime/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?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>org.jboss.shamrock</groupId>
<artifactId>shamrock-kafka-client</artifactId>
<version>1.0.0.Alpha1-SNAPSHOT</version>
</parent>

<artifactId>shamrock-kafka-client-runtime</artifactId>

<dependencies>

<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
</dependency>

<dependency>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
</dependencies>

<build>
<!-- Mark this as a runtime dependency, so to make sure it's included on the final classpath during native-image -->
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.jboss.shamrock</groupId>
<artifactId>shamrock-extension-processor</artifactId>
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>


</project>
Loading

0 comments on commit a4e7ab2

Please sign in to comment.