chapter five

5 Kafka in real-world use cases

 

This chapter covers

  • Key scenarios where Kafka excels
  • Identifying situations where Kafka may not be the ideal choice
  • Comparing Kafka with other technologies that serve similar purposes

When considering the introduction of new technology, it’s crucial to understand both its potential applications and its limitations. Messaging solutions, for instance, vary widely, and different scenarios may be better addressed by specific technologies. However, it’s often advisable to use existing products for new challenges instead of adopting a new solution for every distinct use case.

Now that you understand the basics of how Kafka works, it’s time to put that knowledge to work so you can turn uncertain “should we use Kafka?” conversations into confident, defensible decisions grounded in clear patterns and trade-offs. In this chapter, we’ll walk through high-impact use cases—notifications, external data integration, real-time analytics, and log aggregation—showing when Kafka’s guarantees help and what they cost. To pick the right tool for each job, it’s also crucial to understand antipatterns and edge cases. We’ll also look at alternatives to using Kafka—RabbitMQ, Pulsar, and managed cloud services. You’ll leave this chapter with a practical checklist for evaluating Kafka’s capabilities and appropriateness, a solid mental model of its limits, and implementation pointers for both Kafka-first and Kafka-free designs.

5.1 Navigating real-world implementation

5.1.1 Event-driven microservices

5.1.2 Data integration

5.1.3 Collecting logs

5.1.4 Real-time data processing

5.2 Differences from other messaging platforms

5.2.1 Publish-subscribe model

5.2.2 Partitioned data

5.2.3 Lack of broker-side logic

5.2.4 Sequential data access

5.2.5 Message persistence

5.2.6 Limitations in handling large messages

5.2.7 Scalability and high throughput

5.2.8 Fault tolerance

5.2.9 Batch processing

5.2.10 Lack of global ordering

5.3 Kafka alternatives

5.3.1 RabbitMQ

5.3.2 Apache Pulsar

5.3.3 Solutions from cloud providers

5.4 Online resources