Skip to content

findinpath/testcontainers-kafka-avro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Production/Consumption of Apache Kafka AVRO messages with testcontainers library

This is a showcase on how to test the serialization/deserialization of AVRO messages over Apache Kafka with the help of docker containers (via testcontainers library).

The testcontainers library already offers a Kafka module for interacting with Apache Kafka, but there is not, at the moment, a testcontainers module for the whole Confluent environment (Confluent Schema Registry container support is missing from the module previously mentioned). As a side note, the containers used do not use the default ports exposed by default in the artifacts (e.g. : Apache Zookeeper 2181, Apache Kafka 9092, Confluent Schema Registry 8081), but rather free ports available on the test machine avoiding therefor possible conflicts with already running services on the test machine.

This project provides a functional prototype on how to setup the whole Confluent environment (including Confluent Schema Registry) via testcontainers.

For the test environment the following containers will be started:

  • Apache Zookeeper
  • Apache Kafka
  • Confluent Schema Registry

Once the test environment is started, a BookmarkEvent value type will be registered on the Confluent Schema Registry container and also a Apache Kafka topic called BookmarkEvents will be created.

The test demo will simply verify whether a message serialized in AVRO format can be successfully serialized and sent over Apache Kafka in order to subsequently be deserialized and read by a consumer.

Use

mvn clean install

for trying out the project.

The file testcontainers.properties can be used for overriding the default docker images used for the containers needed in setting up the Confluent test environment.

About

Showcase on producing&consuming avro messages in Apache Kafka testcontainers ecosystem

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages