-
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.
- Loading branch information
1 parent
02937d6
commit e24115b
Showing
23 changed files
with
659 additions
and
72 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
87 changes: 87 additions & 0 deletions
87
...-client/deployment/src/main/java/org/jboss/shamrock/reactivemessaging/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,87 @@ | ||
package org.jboss.shamrock.reactivemessaging; | ||
|
||
import org.apache.kafka.clients.consumer.RangeAssignor; | ||
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; | ||
|
||
import java.util.Collection; | ||
|
||
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())); | ||
|
||
for(Class i : BUILT_INS) { | ||
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, i.getName())); | ||
} | ||
|
||
for (ClassInfo s : serializers) { | ||
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, s.toString())); | ||
} | ||
|
||
for (ClassInfo s : deserializers) { | ||
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, s.toString())); | ||
} | ||
|
||
// Also | ||
// Kafka has is heavily using reflection - at least these 2 classes are instantiated | ||
// The first to produce | ||
// The second to consume | ||
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, DefaultPartitioner.class.getName())); | ||
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, RangeAssignor.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> |
File renamed without changes.
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
Oops, something went wrong.