Skip to content
Ameen Abozaid
Planned lessonMID-045-L03

Contracts for messages

  • Lesson 3 of 6
  • 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

apply contracts to Kafka events.

Planned topics

  • A message is also an API: the producer must not break consumers' parsing.
  • The consumer defines the message shape it reads (OrderPlaced with orderId, lines); the producer verifies it can generate it.
  • Pact message pacts and Spring Cloud Contract messaging both support this; verify the version and the supported broker setups before recording.
  • Combine with a schema registry for compatibility rules (see the messaging modules).
Draft outline details

Demonstration

a contract for OrderPlaced: required orderId (string), totalCents (integer); provider test builds the real event and checks it.

Check your understanding

Why test a message contract?

Show answer

Consumers parse fields; renaming one breaks them silently.

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.