An event producer is a service or application that creates and publishes events for other components to consume. In contract testing, the producer corresponds to the provider, while the subscriber corresponds to the consumer. section 3.8.2 section 8.1
A producer implementation typically separates message creation from broker-specific delivery:
- Configure the broker connection with a unique client ID and broker list. section 8.6
- Construct the event body independently of Kafka or another messaging protocol. section 3.8.2
- Send a keyed message containing the serialized event to the target topic. section 8.6
- Verify the produced message against the consumer’s contract before deployment. section 3.8.2
Movie event producer
A web or mobile client requests a new movie. The producer creates a message containing the movie name and release year, then publishes it to Kafka’s “movies” topic. A subscribed backend service consumes the message and adds the movie to its database. A contract test checks that the message contains the expected content. section 8.1 section 8.6
Figure 8.2 Event-driven architecture communicates via the Kafka message broker passing the message for CDCT from the producer via the “movies” topic to the subscriber.
Trace the producer-to-topic-to-subscriber flow and see how contract-testing terminology reverses the event flow through the Pact Broker. section 8.1







