Add kafka4-migration module: Spring Kafka 3.3 to 4.1 migration on Boot 3.5 to 4.1
Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gth99spB1CzQmBFofXmU4Z
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
$ mvn test # Boot 3.5.16, JDK 21
|
||||
RESULT key=k1 id=o-1 qty=3
|
||||
BROKERS 127.0.0.1:PORT
|
||||
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.853 s -- in com.ankurm.kafka.OrderFlowTest
|
||||
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
|
||||
[INFO] BUILD SUCCESS
|
||||
|
||||
org.apache.kafka:kafka-clients:jar:3.9.2:compile
|
||||
org.springframework.kafka:spring-kafka:jar:3.3.16:compile
|
||||
|
||||
$ java -cp target/classes:<runtime classpath> SerdeProbe
|
||||
SERIALIZED {"id":"o-1","qty":3}
|
||||
@@ -0,0 +1,5 @@
|
||||
$ mvn test # only the Boot version changed to 4.1.1
|
||||
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 5.728 s <<< FAILURE! -- in com.ankurm.kafka.OrderFlowTest
|
||||
[ERROR] OrderFlowTest.sendAndReceive ? UnsatisfiedDependency Error creating bean with name 'com.ankurm.kafka.OrderFlowTest': Unsatisfied dependency expressed through field 'template': No qualifying bean of type 'org.springframework.kafka.core.KafkaTemplate<java.lang.String, com.ankurm.kafka.OrderEvent>' available: expected at
|
||||
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
|
||||
[INFO] BUILD FAILURE
|
||||
@@ -0,0 +1,15 @@
|
||||
$ mvn test # spring-kafka replaced by spring-boot-starter-kafka; nothing else changed
|
||||
RESULT key=k1 id=o-1 qty=3
|
||||
BROKERS localhost:PORT
|
||||
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 9.853 s -- in com.ankurm.kafka.OrderFlowTest
|
||||
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
|
||||
[INFO] BUILD SUCCESS
|
||||
|
||||
org.apache.kafka:kafka-clients:jar:4.2.1:compile
|
||||
org.springframework.boot:spring-boot-kafka:jar:4.1.1:compile
|
||||
org.springframework.kafka:spring-kafka:jar:4.1.1:compile
|
||||
|
||||
$ mvn dependency:list | grep jackson # runtime scope, then test scope
|
||||
runtime: tools.jackson.core:jackson-core:jar:3.1.5:compile
|
||||
runtime: tools.jackson.core:jackson-databind:jar:3.1.5:compile
|
||||
test-only: com.fasterxml.jackson.core:jackson-databind:jar:2.21.5:test
|
||||
@@ -0,0 +1,3 @@
|
||||
$ compile and run SerdeProbe on the runtime classpath only (JsonSerializer from Spring Kafka 4.1.1)
|
||||
[ERROR] class file for com.fasterxml.jackson.core.type.TypeReference not found
|
||||
[ERROR] s2/src/main/java/com/ankurm/kafka/SerdeProbe.java:[9,45] cannot access com.fasterxml.jackson.core.type.TypeReference
|
||||
@@ -0,0 +1,13 @@
|
||||
$ mvn test # final migrated project (JacksonJsonSerializer, spring-boot-starter-jackson)
|
||||
RESULT key=k1 id=o-1 qty=3
|
||||
BROKERS localhost:PORT
|
||||
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.478 s -- in com.ankurm.kafka.OrderFlowTest
|
||||
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
|
||||
[INFO] BUILD SUCCESS
|
||||
|
||||
org.apache.kafka:kafka-clients:jar:4.2.1:compile
|
||||
org.springframework.boot:spring-boot-kafka:jar:4.1.1:compile
|
||||
org.springframework.kafka:spring-kafka:jar:4.1.1:compile
|
||||
|
||||
$ java -cp target/classes:<runtime classpath> SerdeProbe
|
||||
SERIALIZED {"id":"o-1","qty":3}
|
||||
@@ -0,0 +1,2 @@
|
||||
$ jar tf spring-kafka-4.1.1.jar | grep support/serializer/(Json|Jackson)
|
||||
JacksonJsonDeserializer.class JacksonJsonSerde.class JacksonJsonSerializer.class JacksonJsonTypeResolver.class JsonDeserializer.class JsonSerde.class JsonSerializer.class JsonTypeResolver.class
|
||||
Reference in New Issue
Block a user