DEV Community

Isreal Urephu
Isreal Urephu

Posted on

๐—ช๐—ต๐˜† ๐—บ๐—ฎ๐—ป๐˜† ๐—บ๐—ผ๐—ฑ๐—ฒ๐—ฟ๐—ป ๐˜„๐—ฒ๐—ฏ ๐—ฎ๐—ฝ๐—ฝ๐˜€ ๐—ฟ๐˜‚๐—ป ๐—ผ๐—ป ๐—˜๐˜ƒ๐—ฒ๐—ป๐˜-๐——๐—ฟ๐—ถ๐˜ƒ๐—ฒ๐—ป ๐—”๐—ฟ๐—ฐ๐—ต๐—ถ๐˜๐—ฒ๐—ฐ๐˜๐˜‚๐—ฟ๐—ฒ (๐—˜๐——๐—”) ๐Ÿš€

๐—ช๐—ต๐˜† ๐—บ๐—ฎ๐—ป๐˜† ๐—บ๐—ผ๐—ฑ๐—ฒ๐—ฟ๐—ป ๐˜„๐—ฒ๐—ฏ ๐—ฎ๐—ฝ๐—ฝ๐˜€ ๐—ฟ๐˜‚๐—ป ๐—ผ๐—ป ๐—˜๐˜ƒ๐—ฒ๐—ป๐˜-๐——๐—ฟ๐—ถ๐˜ƒ๐—ฒ๐—ป ๐—”๐—ฟ๐—ฐ๐—ต๐—ถ๐˜๐—ฒ๐—ฐ๐˜๐˜‚๐—ฟ๐—ฒ (๐—˜๐——๐—”) ๐Ÿš€

Think about Amazon or any big e-commerce site. Behind the scenes, dozens of different services inventory, payments, notifications, billing all need to work together smoothly.

In a traditional setup, this communication happens directly between services. For example:

โ€ข ๐—ฆ๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฐ๐—ฒ ๐—” calls ๐—ฆ๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฐ๐—ฒ ๐—• (like a client talking to a server).
โ€ข Service B processes the request and sends a response back.
โ€ข This is ๐˜ด๐˜บ๐˜ฏ๐˜ค๐˜ฉ๐˜ณ๐˜ฐ๐˜ฏ๐˜ฐ๐˜ถ๐˜ด โ€” Service A waits until Service B finishes.

The problem? If Service B is slow or goes down, Service A suffers too. This creates ๐˜๐—ถ๐—ด๐—ต๐˜ ๐—ฐ๐—ผ๐˜‚๐—ฝ๐—น๐—ถ๐—ป๐—ด between services.

๐—˜๐˜ƒ๐—ฒ๐—ป๐˜-๐——๐—ฟ๐—ถ๐˜ƒ๐—ฒ๐—ป ๐—”๐—ฟ๐—ฐ๐—ต๐—ถ๐˜๐—ฒ๐—ฐ๐˜๐˜‚๐—ฟ๐—ฒ ๐ŸŽฏ

Instead of talking directly, services use a broker (think of it as a post office for events).

Hereโ€™s how it works:

๐Ÿญ. Service A becomes a ๐—ฝ๐—ฟ๐—ผ๐—ฑ๐˜‚๐—ฐ๐—ฒ๐—ฟ โ€” it sends an event to the broker.
๐Ÿฎ. The broker holds the event until someone is ready to process it.
๐Ÿฏ. Service B (the ๐—ฐ๐—ผ๐—ป๐˜€๐˜‚๐—บ๐—ฒ๐—ฟ) subscribes to the broker and processes events when itโ€™s ready.

The benefits?
โœ… Services are ๐—ฑ๐—ฒ๐—ฐ๐—ผ๐˜‚๐—ฝ๐—น๐—ฒ๐—ฑ they donโ€™t depend on each otherโ€™s availability.
โœ… Events can be processed ๐—ฎ๐˜€๐˜†๐—ป๐—ฐ๐—ต๐—ฟ๐—ผ๐—ป๐—ผ๐˜‚๐˜€๐—น๐˜† and even in parallel.
โœ… If one service goes down, the broker still holds the events until it comes back.

This approach is why you can order something online, get an instant confirmation, and still receive updates later even if some backend services were temporarily offline.

Event-Driven Architecture = ๐˜€๐—ฐ๐—ฎ๐—น๐—ฎ๐—ฏ๐—น๐—ฒ, ๐—ฟ๐—ฒ๐˜€๐—ถ๐—น๐—ถ๐—ฒ๐—ป๐˜, and ๐—ฟ๐—ฒ๐—ฎ๐—ฑ๐˜† for the unpredictable.

Top comments (0)