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
This package offers a high-performance, **in-process event dispatcher** for Go, ideal for decoupling modules and enabling asynchronous event handling. It supports both synchronous and asynchronous processing, focusing on speed and simplicity.
13
+
-**High Performance:** Processes millions of events per second, about **10x faster** than channels.
14
+
-**Generic:** Works with any type implementing the `Event` interface.
15
+
-**Asynchronous:** Each subscriber runs in its own goroutine, ensuring non-blocking event handling.
16
+
17
+
**Use When:**
18
+
- ✅ Decoupling modules within a single Go process.
19
+
- ✅ Implementing lightweight pub/sub or event-driven patterns.
- ✅ Preferring a simple, dependency-free solution.
22
+
23
+
**Not For:**
24
+
- ❌ Inter-process/service communication (use Kafka, NATS, etc.).
25
+
- ❌ Event persistence, durability, or advanced routing/filtering.
26
+
- ❌ Cross-language/platform scenarios.
27
+
- ❌ Event replay, dead-letter queues, or deduplication.
28
+
- ❌ Heavy subscribe/unsubscribe churn or massive dynamic subscriber counts.
29
+
10
30
## Generic In-Process Pub/Sub
11
31
12
32
This repository contains a **simple, in-process event dispatcher** to be used to decouple internal modules. It provides a generic way to define events, publish and subscribe to them.
@@ -78,12 +98,18 @@ It should output something along these lines, where order is not guaranteed give
78
98
79
99
## Benchmarks
80
100
101
+
Please note that the benchmarks are run on a 13th Gen Intel(R) Core(TM) i7-13700K CPU, and results may vary based on the machine and environment. This one demonstrates the publishing throughput of the event dispatcher, at different number of event types and subscribers.
0 commit comments