Skip to content

Path 9 of 10

Spring Boot and Java Integration

Spring for Apache Kafka on Java 21 and Spring Boot 3: templates, listeners, error handling, transactions and tests.

0 / 6 lessons completed ยท about 173 min in total

After this path you can

Outcomes

  • Configure producers and listeners explicitly
  • Handle bad records, retries and dead letters in Spring
  • Test Kafka code against a real broker with Testcontainers

Lessons

  1. 1Spring Kafka setup: what Boot builds and what you configureWire a Spring Boot service to Kafka: the beans Boot creates from spring.kafka properties, producer and consumer configuration, topics as code, profiles and a local KRaft broker.Intermediate30 min
  2. 2@KafkaListener in depth: threads, acknowledgements, batchesWhat runs behind @KafkaListener: the listener container and its threads, when offsets are committed in each ack mode, batch listeners, concurrency against partitions, and pausing.Advanced35 min
  3. 3Serialisation in Spring Kafka: JSON, type headers, AvroHow Java objects become record bytes and back: JsonSerializer and JsonDeserializer, type headers and trusted packages, ErrorHandlingDeserializer, and Avro with a schema registry.Intermediate30 min
  4. 4Error handling, retries and dead letters in SpringOne production-shaped Spring configuration: DefaultErrorHandler with a back-off, a dead-letter recoverer, ErrorHandlingDeserializer, and @RetryableTopic when retries must not block.Advanced26 min
  5. 5Kafka transactions in Spring BootWhat transaction-id-prefix switches on, the three ways Spring starts a Kafka transaction, and exactly what happens when a database transaction is involved as well.Advanced25 min
  6. 6Testing and observing Spring Kafka applicationsTest listeners as plain classes and against a real broker with Testcontainers, then make them observable: Micrometer metrics, traces across topics and safe, searchable logs.Advanced27 min

Related labs

Simulations, not a real cluster.

  1. Lab 1Producer publishing messagesFoundation20 min
  2. Lab 3Consumer group assignmentFoundation20 min
  3. Lab 4Adding and removing consumersIntermediate25 min
  4. Lab 5Duplicate message processingIntermediate25 min
  5. Lab 6Consumer crash before offset commitIntermediate25 min
  6. Lab 7Poison message and dead-letter queueIntermediate25 min
  7. Lab 8Retry and backoff strategyIntermediate30 min
  8. Lab 10Consumer lag during high loadIntermediate30 min
  9. Lab 12Transactional outboxAdvanced30 min
  10. Lab 13Database unavailable while consuming Kafka messagesAdvanced35 min
  11. Lab 14Kafka transactionAdvanced35 min
  12. Lab 15Schema evolutionAdvanced35 min