You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/event_streaming_message/apache_kafka.md
+148Lines changed: 148 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,3 +122,151 @@ RabbitMQ, and Kafka are designed for messaging or communication between systems
122
122
|**Kafka**|**High-throughput event streaming**, **log aggregation**, **real-time analytics**|**Overly complex** for simple tasks, lacks **routing** and **priority features**, more setup and management |
123
123
124
124
RabbitMQ is ideal for cases where **reliability, routing, and discrete task management** are important, while Kafka excels at **high-throughput, durable event streams** where **scalability** and **real-time analytics** are the focus. Each platform serves different types of workloads, and using the wrong one for a particular job can result in added complexity and inefficiencies.
125
+
126
+
127
+
## Point-to-Point and Publish-Subscribe
128
+
129
+
130
+
### 1. **RabbitMQ** – **Point-to-Point** and **Publish-Subscribe**
131
+
RabbitMQ is a message broker that supports both the **Point-to-Point** and **Publish-Subscribe** messaging patterns.
132
+
133
+
-**Point-to-Point (Queue-based messaging)**: In RabbitMQ, a sender can publish a message to a queue, and the message will be delivered to **one specific receiver** that pulls the message from the queue. This fits the **Point-to-Point** pattern.
134
+
135
+
-**Publish-Subscribe (Exchange-based messaging)**: RabbitMQ also supports the **Publish-Subscribe** pattern through **exchanges**. A publisher sends a message to an exchange, which routes the message to all the queues bound to that exchange. Subscribers, consuming messages from their respective queues, receive a copy of the message.
136
+
137
+
### 2. **Kafka** – **Publish-Subscribe**
138
+
Kafka implements a **distributed log-based messaging system** that is primarily designed for the **Publish-Subscribe** pattern.
139
+
140
+
-**Publish-Subscribe (Topic-based messaging)**: In Kafka, a producer publishes messages to a **topic**, and any number of **consumers** (subscribers) can subscribe to that topic to consume the messages. Kafka ensures durability and allows replay of messages from the log, making it very suitable for event streaming and high-throughput, fault-tolerant use cases.
141
+
142
+
143
+
144
+
Here’s a basic overview and code implementation of the **Publish-Subscribe** and **Point-to-Point** design patterns in C++ along with a UML diagram.
145
+
146
+
### 1. Publish-Subscribe Design Pattern
147
+
In this pattern, the *publisher* doesn't send messages directly to specific receivers. Instead, messages are sent to a *topic*, and any number of *subscribers* can receive the messages.
0 commit comments