
How to Monitor Kafka Consumer Lag From Java Services
Compute Kafka consumer lag with the AdminClient, export it as a Micrometer gauge, set time based alerts and learn what a growing lag really means.
Everything you need to level up your coding skills.

Compute Kafka consumer lag with the AdminClient, export it as a Micrometer gauge, set time based alerts and learn what a growing lag really means.

Understand how Kafka topics split into partitions, how the message key picks the partition and ordering follows from it, and size partitions for consumers.

Version event schemas with Avro and a schema registry in Java: define a schema, set compatibility modes, evolve fields safely, use Spring Kafka.

Write a Kafka consumer that survives restarts, duplicates, poison messages and slow batches, with manual commits, idempotency, retries and a dead letter topic

Add retries and a dead letter topic to a Spring Kafka consumer: DefaultErrorHandler, backoff, DeadLetterPublishingRecoverer and RetryableTopic.

Configure RabbitMQ with Spring AMQP so messages are never lost or stuck: acks, publisher confirms, bounded retries and dead letter queues.

Define unit, integration and end-to-end tests in a Java service by what each one starts, what it can catch and what it costs to run.

Wire Testcontainers into Spring Boot tests with @ServiceConnection: no dynamic properties, supported containers, local development with TestApplication.

Mock HTTP dependencies with WireMock in JUnit: stubbing responses, verifying requests, simulating delays and faults, scenarios and Spring integration.

Understand the JUnit Jupiter extension model: extension points, ExtendWith, parameter resolvers, callbacks and conditions, with three custom examples.

Make tests deterministic by injecting Clock, a Random seed and an id supplier, instead of calling now, Math.random and UUID.randomUUID inside the code.

Find and fix flaky Java tests: detect them with reruns and random order, learn the causes with examples and quarantine safely.
We send one email when a new post is published. No spam.