Event Driven Services
Uses events to trigger and communicate between decoupled services in micro services
Event-driven architectures have three key components:
- Event Producers, Event routers, and Event Consumer
Use Case 1: Web Sockets
WebSockets provide a full-duplex, bidirectional communication channel over a single TCP connection
Use Cases: Real-time chat applications, live sports score updates, and other scenarios where instant communication is required.
Use Case 2: Server Side Events (SSE)
In SSE, the server pushes updates to the client over a single HTTP connection
Use Cases: Web hook responses back to client, update notifications without continuous HTTP calls from client -> server.
More in: Web Hook & SSE
Difference on Event Drives vs Pub - Sub
- Pub/Sub (messaging) services are used for larger payloads.
- The publisher is sending the data to a topic where you can send custom headers to allow for subscribers to easily filter messages before they land in their topic’s subscription.
- So in this case the publisher is expecting a subscribing system to do something with the data being sent.
- Events are notifications but normally don’t include the entire payload.
- It can be used to signify that a state has changed or that something was created or deleted. It’s metadata, not the actual data.
- Like messaging services you can also subscribe to these and filter out events based on properties in the event payload.