Search⌘ K

Example: Testing & Other Data Formats

Explore how to implement embedded Kafka servers in JUnit tests to streamline microservice testing without extra infrastructure. Understand the use of Avro data format with schema support for efficient and flexible data serialization, enabling schema evolution and backward compatibility in microservices messaging.

We'll cover the following...

Tests with embedded Kafka #

In a JUnit test, an embedded Kafka server can be used to analyze the functionality of the microservices. In this case, a Kafka server runs in the same Java Virtual Machine (JVM) as the test. Thus, it is not necessary to build up an infrastructure for the test, and consequently, there is no need to tear down the infrastructure again after the test.

This requires two things essentially:

  • An embedded Kafka server has to be started. With a class rule, JUnit can be
...