Skip to content

Commit 87bb8e1

Browse files
shade the kafka dependency
1 parent a50c827 commit 87bb8e1

File tree

5 files changed

+52
-58
lines changed

5 files changed

+52
-58
lines changed

.idea/runConfigurations/kafka_clients_example.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/spring_example.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

superstream-clients/dependency-reduced-pom.xml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>ai.superstream</groupId>
55
<artifactId>superstream-clients</artifactId>
66
<name>Superstream Kafka Client Optimizer</name>
7-
<version>1.0.9</version>
7+
<version>1.0.10</version>
88
<description>A Java library that dynamically optimizes Kafka client configuration based on recommendations</description>
99
<url>https://github.com/superstreamlabs/superstream-clients-java</url>
1010
<developers>
@@ -76,7 +76,24 @@
7676
<pattern>com.fasterxml</pattern>
7777
<shadedPattern>ai.superstream.shaded.com.fasterxml</shadedPattern>
7878
</relocation>
79+
<relocation>
80+
<pattern>org.apache.kafka</pattern>
81+
<shadedPattern>ai.superstream.shaded.org.apache.kafka</shadedPattern>
82+
</relocation>
7983
</relocations>
84+
<filters>
85+
<filter>
86+
<artifact>*:*</artifact>
87+
<excludes>
88+
<exclude>META-INF/*.SF</exclude>
89+
<exclude>META-INF/*.DSA</exclude>
90+
<exclude>META-INF/*.RSA</exclude>
91+
</excludes>
92+
</filter>
93+
</filters>
94+
<transformers>
95+
<transformer />
96+
</transformers>
8097
</configuration>
8198
</execution>
8299
</executions>

superstream-clients/pom.xml

Lines changed: 31 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>ai.superstream</groupId>
88
<artifactId>superstream-clients</artifactId>
9-
<version>1.0.9</version>
9+
<version>1.0.10</version>
1010
<packaging>jar</packaging>
1111

1212
<name>Superstream Kafka Client Optimizer</name>
@@ -60,49 +60,6 @@
6060
<groupId>org.apache.kafka</groupId>
6161
<artifactId>kafka-clients</artifactId>
6262
<version>${kafka.version}</version>
63-
<exclusions>
64-
<exclusion>
65-
<groupId>org.slf4j</groupId>
66-
<artifactId>slf4j-nop</artifactId>
67-
</exclusion>
68-
<exclusion>
69-
<groupId>org.slf4j</groupId>
70-
<artifactId>slf4j-simple</artifactId>
71-
</exclusion>
72-
<exclusion>
73-
<groupId>org.slf4j</groupId>
74-
<artifactId>slf4j-log4j12</artifactId>
75-
</exclusion>
76-
<exclusion>
77-
<groupId>org.slf4j</groupId>
78-
<artifactId>slf4j-jdk14</artifactId>
79-
</exclusion>
80-
<exclusion>
81-
<groupId>org.slf4j</groupId>
82-
<artifactId>slf4j-jcl</artifactId>
83-
</exclusion>
84-
<exclusion>
85-
<groupId>ch.qos.logback</groupId>
86-
<artifactId>logback-classic</artifactId>
87-
</exclusion>
88-
<exclusion>
89-
<groupId>org.slf4j</groupId>
90-
<artifactId>slf4j-api</artifactId>
91-
</exclusion>
92-
</exclusions>
93-
</dependency>
94-
95-
<!-- SLF4J API -->
96-
<dependency>
97-
<groupId>org.slf4j</groupId>
98-
<artifactId>slf4j-api</artifactId>
99-
<version>2.0.11</version>
100-
</dependency>
101-
102-
<dependency>
103-
<groupId>ch.qos.logback</groupId>
104-
<artifactId>logback-classic</artifactId>
105-
<version>1.4.14</version>
10663
</dependency>
10764

10865
<!-- ByteBuddy for bytecode manipulation -->
@@ -186,7 +143,27 @@
186143
<pattern>com.fasterxml</pattern>
187144
<shadedPattern>ai.superstream.shaded.com.fasterxml</shadedPattern>
188145
</relocation>
146+
<!-- Add Kafka relocation -->
147+
<relocation>
148+
<pattern>org.apache.kafka</pattern>
149+
<shadedPattern>ai.superstream.shaded.org.apache.kafka</shadedPattern>
150+
</relocation>
189151
</relocations>
152+
<!-- Optional: Filter to transform MANIFEST files to avoid conflicts -->
153+
<filters>
154+
<filter>
155+
<artifact>*:*</artifact>
156+
<excludes>
157+
<exclude>META-INF/*.SF</exclude>
158+
<exclude>META-INF/*.DSA</exclude>
159+
<exclude>META-INF/*.RSA</exclude>
160+
</excludes>
161+
</filter>
162+
</filters>
163+
<!-- Optional: Transformer to handle service providers -->
164+
<transformers>
165+
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
166+
</transformers>
190167
</configuration>
191168
</execution>
192169
</executions>
@@ -240,14 +217,14 @@
240217
</executions>
241218
</plugin>
242219

243-
<!-- maven-install-plugin -->
244-
<plugin>
220+
<!-- maven-install-plugin -->
221+
<plugin>
245222
<artifactId>maven-install-plugin</artifactId>
246223
<version>2.5.2</version>
247224
</plugin>
248225

249-
<!-- central-publishing-maven-plugin -->
250-
<plugin>
226+
<!-- central-publishing-maven-plugin -->
227+
<plugin>
251228
<groupId>org.sonatype.central</groupId>
252229
<artifactId>central-publishing-maven-plugin</artifactId>
253230
<version>0.4.0</version>
@@ -264,9 +241,9 @@
264241
</configuration>
265242
</execution>
266243
</executions>
267-
</plugin>
268-
<!-- Disabling the default maven-deploy-plugin -->
269-
<plugin>
244+
</plugin>
245+
<!-- Disabling the default maven-deploy-plugin -->
246+
<plugin>
270247
<artifactId>maven-deploy-plugin</artifactId>
271248
<version>3.1.1</version>
272249
<executions>
@@ -277,7 +254,7 @@
277254
</executions>
278255
</plugin>
279256

280-
<plugin>
257+
<plugin>
281258
<groupId>org.apache.maven.plugins</groupId>
282259
<artifactId>maven-gpg-plugin</artifactId>
283260
<version>3.2.3</version>
@@ -296,7 +273,7 @@
296273
</configuration>
297274
</execution>
298275
</executions>
299-
</plugin>
276+
</plugin>
300277
</plugins>
301278
<resources>
302279
<resource>
@@ -309,7 +286,7 @@
309286
<include>README.md</include>
310287
</includes>
311288
<targetPath>.</targetPath> <!-- place it in root of jar -->
312-
</resource>
289+
</resource>
313290
</resources>
314291
</build>
315292

superstream-clients/src/main/java/ai/superstream/agent/SuperstreamAgent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private static void install(Instrumentation instrumentation) {
5050
// Intercept KafkaProducer constructor
5151
new AgentBuilder.Default()
5252
.disableClassFormatChanges()
53-
.type(ElementMatchers.named("org.apache.kafka.clients.producer.KafkaProducer"))
53+
.type(ElementMatchers.nameEndsWith("KafkaProducer"))
5454
.transform((builder, typeDescription, classLoader, module, protectionDomain) ->
5555
builder.visit(Advice.to(KafkaProducerInterceptor.class)
5656
.on(ElementMatchers.isConstructor())))

0 commit comments

Comments
 (0)