Spring for Apache Kafka
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
KafkaTemplatesends records;@KafkaListenerconsumes.- Configure serializers (String, JSON) and the consumer
group-idinapplication.yml. - Set the listener ack mode (default commits after the batch is processed;
MANUALfor control). - Use a JSON serializer with a trusted-packages setting, or a schema registry (MID-029).
auto.offset.resetdecides where a new group starts (earliestorlatest).- Check configuration names against the Spring Boot version before recording.
Draft outline details
Demonstration
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.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.