-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #977 from stuartwdouglas/kafka
Add Kafka and Kafka Reactive Messaging extensions
- Loading branch information
Showing
21 changed files
with
913 additions
and
0 deletions.
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,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> |
93 changes: 93 additions & 0 deletions
93
...nsions/kafka-client/deployment/src/main/java/org/jboss/shamrock/kafka/KafkaProcessor.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,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())); | ||
|
||
} | ||
} |
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,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> |
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,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> |
Oops, something went wrong.