Date Tags Kafka / Java

Version 3.0.0 of Kafka for JUnit has been released. It increases all Kafka dependencies to 3.0.0.

Due to changes at the level of the Kafka Configuration API it is no longer possible to override the default listening port of 9092 with a user-supplied one using the KafkaConfig$.MODULE$.PortProp() parameter (same goes for KafkaConfig$.MODULE$.HostnameProp().

This has some implications for multi-broker setups with Kafka for JUnit. In a multi-broker setup, Kafka for JUnit will always generate a set of ephemeral ports and configure the listener configuration parameter for each and every broker in your test setup as appropriate. To ease the burden on the API of Kafka for JUnit, this behavior cannot be overridden.

This is not the case for single-broker setups. Although it is no longer possible to use the aforementioned configuration parameters, users can override the listener configuration by providing a configuration value for KafkaConfig$.MODULE$.ListenerProp(). Using defaults, Kafka for JUnit will - as it has been ever since - start the embedded broker at the default port 9092 using the PLAINTEXT protocol. Single-broker integration tests are able to switch to another protocol by overriding this parameter as well. Multi-broker integration tests are - for the time being - only admissible with the PLAINTEXT protocol in place as a means to not overcomplicate things.

Changelog

See the changelog on GitHub.

Features

Bugfixes

None.

Get it

You can obtain the binaries from Maven central or include the dependency using the following Maven coordinates in your build.

Maven

<dependency>
  <groupId>net.mguenther.kafka</groupId>
  <artifactId>kafka-junit</artifactId>
  <version>3.0.0</version>
</dependency>

Gradle

compile 'net.mguenther.kafka:kafka-junit:3.0.0'

Hi there! I'm Markus!

I'm an independent freelance IT consultant, a well-known expert for Apache Kafka and Apache Solr, software architect (iSAQB certified) and trainer.

How can I support you?

GET IN TOUCH