Programming ConceptsEvent-Driven Architecture

In event-driven architecture, services communicate by producing and consuming events, allowing for loose coupling and asynchronous communication.

// Example with Node.js EventEmitter
const EventEmitter = require('events');
const eventEmitter = new EventEmitter();
eventEmitter.on('orderPlaced', (order) => console.log('Order received:', order));
eventEmitter.emit('orderPlaced', { id: 1, item: 'Laptop' });