Kafka, Event-Driven Systems & Stream Processing
How Apache Kafka works inside, how to produce and consume safely, how to design event-driven systems and event contracts, and how to process streams with Flink and Kafka Streams.
Kafka is a distributed, replicated, append-only log. Producers append events; consumers read them at their own pace and can replay them later. Event-driven architecture builds on that log so services can react to facts instead of calling each other synchronously. Stream processing turns the flowing events into answers: aggregates, joins, alerts and features.
Articles
- Kafka architectureHow Kafka works inside: topics, partitions and offsets, brokers and replication (leaders, ISR, min.insync.replicas), KRaft controllers, consumer groups and share groups (queues), retention, compaction and tiered storage, and how to size and operate a cluster.
- Producers, consumers & exactly-onceProducing and consuming safely: batching and partitioning, idempotent producers, at-most-once vs at-least-once vs exactly-once, Kafka transactions and read_committed, offset management, rebalancing, retries, dead-letter topics and backpressure, with Spring for Apache Kafka examples.
- Event-driven architectureDesigning systems around events: events vs commands vs queries, the four event patterns (notification, event-carried state transfer, event sourcing, CQRS), choreography vs orchestration, topic and event design, ordering, idempotency, versioning, observability, and when not to go event-driven.
- Schemas & event contractsTreating events as contracts: Avro vs Protobuf vs JSON Schema, schema registries, compatibility modes (backward, forward, full, transitive), safe and breaking changes, versioning strategies, data contracts, and governance in CI.
- Stream processingProcessing events continuously: stateless vs stateful operations, event time and watermarks, windows, stream-table joins, state and checkpoints, exactly-once, Apache Flink 2.x vs Kafka Streams, Flink SQL, streaming for AI, and a real-time fraud scoring pipeline.
- Case study: real-time paymentsA complete design for an event-driven instant payments platform (SEPA Instant / UPI style): requirements, the synchronous and asynchronous split, Kafka topic and key design, idempotency, the ledger, fraud scoring in the stream, notifications, reconciliation, multi-region, security and trade-offs.