Event Driven Architecture
Definition
A software architecture paradigm promoting the production, detection, consumption of, and reaction to events.
Explain Like I'm New
Instead of writing one massive 500-line function that does A, then B, then C, then D, you write 4 tiny isolated functions. Function A finishes its job and simply shouts 'I am done!'. Function B hears that shout, does its job, and shouts 'I am done!'. The code is completely decoupled. If you want to remove Function C, you just delete it. You don't have to rewrite Function A.
Real World Example
Microservices. An 'Order Service' accepts a credit card and publishes an 'Order Paid' event to a message queue (like RabbitMQ or Kafka). The 'Inventory Service' and 'Shipping Service' are just sitting there listening. They hear the event and instantly start packing the box.
Common Use Cases
- •Microservices
- •Scalable backend systems
- •Real-time gaming servers
Interactive Example
Interview Questions
basic
- What is a 'Publisher' and a 'Subscriber'?
intermediate
- What is the main benefit of Event-Driven Architecture?