advancedEvent-Driven Architecture with Kafka

What's the fundamental difference between a service calling another service's REST API vs publishing a Kafka event?

A REST call is synchronous and tightly coupled — the caller needs the callee to be up right now and waits for a response, and adding a new consumer means changing the producer's code to call it too. Publishing a Kafka event decouples them completely: the producer doesn't know or care who's listening, new consumers can be added later with zero changes to the producer, and if a consumer is temporarily down, the event just waits in the topic.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to Why might using Kafka introduce eventual consistency bugs that a direct REST call wouldn't have?← Back to all Spring Boot questions