Version 2.4.0 of Kafka for JUnit has been released. It increases all Kafka dependencies to 2.4.0 as well as the Testcontainers for Kafka dependency to 1.12.4.
Unfortunately, the upgrade of the Kafka dependencies to their latest version introduced breaking changes into Kafka for JUnit. The default TopicManager implementation that comes with this library had to be re-written entirely, as the former ZkUtils-based approach is no longer working for Kafka 2.4.0.
ExternalKafkaClusterno longer requires a ZooKeeper connection URL. This means that instead of using
ExternalKafkaCluster.at(bootstrapServers, zkConnectString), you have to use
ExternalKafkaCluster.at(bootstrapServers)from now on.
- To shield us from Kafka API changes, we copied the essential parts of the
net.mguenther.kafka.junit.LeaderAndIsr. The latter is a simple transfer object which closes only over the node IDs of the leader and the In-Sync-Replica set. This means:
- Change package imports from
- If you rely on
LeaderAndIsr#leaderin your test cases you should change that call to
LeaderAndIsr#getLeader. This is not necessary straight away, but the method
LeaderAndIsr#leaderwill be removed with a future release.
See the changelog on GitHub.
You can obtain the binaries from Maven central or include the dependency using the following Maven coordinates in your build.
<dependency> <groupId>net.mguenther.kafka</groupId> <artifactId>kafka-junit</artifactId> <version>2.4.0</version> </dependency>