ProducersはKafkaトピックに対してイベントをパブリッシュ(書き込み)し、Consumersはそこからイベントをサブスクライブ(読み取り)します。パーティショニング、オフセット、コンシューマグループを含むそれらの動作を理解することは、Kafkaを使用する上で基本となります。
Producers — イベントの書き込み
PRODUCERS publish events to TOPICS:
→ send a record (key, value) to a topic
→ the key determines the PARTITION (same key → same partition → ordering for that key);
no key → distributed (round-robin)
→ can configure ACKNOWLEDGMENTS (acks) for durability (wait for replicas to confirm)
→ batching, compression for throughput
Consumers — イベントの読み取り
CONSUMERS subscribe to topics and read events:
→ read from partitions, tracking their OFFSET (position) → resume from where they left off
→ read at their OWN PACE (events are retained); can re-read (replay) from any offset
→ COMMIT offsets to record progress (so they don't reprocess on restart)
