_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN
Let's talk

Event-Driven Programming

06. 11. 2025 1 min read intermediate

Event-driven architektura odděluje producenty a konzumenty. Loosely coupled, škálovatelné, resilientní systémy.

Publish/Subscribe pattern

Python — simple event bus

class EventBus: def __init__(self): self.handlers = {} def subscribe(self, event_type, handler): self.handlers.setdefault(event_type, []).append(handler) def publish(self, event_type, data): for handler in self.handlers.get(event_type, []): handler(data) bus = EventBus() bus.subscribe(‘user.created’, send_welcome_email) bus.subscribe(‘user.created’, create_default_settings) bus.publish(‘user.created’, {‘id’: 1, ‘email’: ‘[email protected]’})

Kafka

Producer

from kafka import KafkaProducer producer = KafkaProducer(bootstrap_servers=’localhost:9092’) producer.send(‘events’, json.dumps({‘type’: ‘order.created’, ‘data’: {…}}).encode())

Consumer

from kafka import KafkaConsumer consumer = KafkaConsumer(‘events’, bootstrap_servers=’localhost:9092’) for message in consumer: event = json.loads(message.value) handle_event(event)

Key Takeaway

Events pro loosely coupled systémy. Kafka pro high-throughput, RabbitMQ pro complex routing.

event-drivenarchitecturekafkarabbitmq
Share:

CORE SYSTEMS tým

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.