Skip to content
Ameen Abozaid
Planned lessonMID-028-L05

Spring for Apache Kafka

  • Lesson 5 of 9
  • Mid-level
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

produce and consume from Spring.

Planned topics

  • KafkaTemplate sends records; @KafkaListener consumes.
  • Configure serializers (String, JSON) and the consumer group-id in application.yml.
  • Set the listener ack mode (default commits after the batch is processed; MANUAL for control).
  • Use a JSON serializer with a trusted-packages setting, or a schema registry (MID-029).
  • auto.offset.reset decides where a new group starts (earliest or latest).
  • Check configuration names against the Spring Boot version before recording.
Draft outline details

Demonstration

java
kafka.send("orders", order.id(), new OrderPlaced(order.id(), order.total()));

@KafkaListener(topics = "orders", groupId = "inventory")
void on(OrderPlaced e) { reserve(e); }

Check your understanding

Which property gives each service its own copy of all events?

Show answer

A distinct group-id.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.