Chapter 11. The Event Bus: The Backbone
In Chapter 10, we discussed Reactive Messaging and utilizing its annotations to produce, consume, and process messages, as well as to bridge imperative and reactive programming. This chapter dives deeper into the backbone of a reactive system built with Reactive Messaging, focusing on Apache Kafka and Advanced Message Queuing Protocol (AMQP).1
Kafka or AMQP: Picking the Right Tool
Plenty of messaging solutions let you implement event-driven architecture, event streaming, and reactive systems in general. Recently, Apache Kafka became a prominent player in this space. AMQP is another approach for messaging that should not be immediately ruled out. Both have pros and cons. Your choice depends entirely on your use cases, and to a lesser extent the existing skills and experience of a team.
Rather than favoring one event bus over another, this section details the characteristics and behaviors of each, along with their relative strengths and weaknesses. We want to provide you sufficient information about each system, enabling you to determine how they may fit into the use cases for a particular system.
At a high level, Kafka can be described as smart consumers with a dumb broker, while AMQP has a smart broker but dumb consumers. Sometimes the choice comes down to the amount of flexibility needed when implementing a solution.
Sure it’s cliché, but there really is no one-size-fits-all event bus. Each situation has specific requirements and use cases ...
Get Reactive Systems in Java now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.