Kafka MockConsumer and MockProducer Example (JUnit 6)
Unit test Kafka producers and consumers with MockProducer and MockConsumer in JUnit 6. Send, read, simulate failures and fix the two setup traps.
Unit test Kafka producers and consumers with MockProducer and MockConsumer in JUnit 6. Send, read, simulate failures and fix the two setup traps.
Kafka queues let many consumers in a share group read the same partition and acknowledge each record on its own. This guide compares share groups with consumer groups, lists the status in Kafka 4.x and the broker settings, and builds a Spring Kafka share consumer with acknowledge, release and reject.
Learn to integrate Kafka with Apache Avro and Schema Registry to manage the changes in Schema over time, and a demo to test this integration.
Spring @KafkaListener and @KafkaHandler annotations provide convenient ways to consume and handle messages from Kafka topics.
Learn to configure KafkaAdmin with custom properties, and create new topics in the Kafka cluster using AdminClient.createTopics() with example.
Learn the basics of KafkaTemplate, configure KafkaTemplate with custom properties, and configure producer and consumer factories with examples.
Run a single-node Kafka and a 3-node Kafka cluster with Docker Compose in KRaft mode on Kafka 4.3, then test replication, leader election and failover with real output.
HowToDoInJava provides tutorials and how-to guides on Java and related technologies.
It also shares the best practices, algorithms & solutions and frequently asked interview questions.