Producers Kafka topics ਵਿੱਚ events ਨੂੰ publish ਕਰਦੇ ਹਨ (write), ਅਤੇ consumers ਉਨ੍ਹਾਂ ਤੋਂ events ਨੂੰ subscribe ਕਰਦੇ ਹਨ (read)। ਇਸ ਗੱਲ ਨੂੰ ਸਮਝਣਾ ਕਿ ਉਹ ਕਿਵੇਂ ਕੰਮ ਕਰਦੇ ਹਨ — partitioning, offsets, ਅਤੇ consumer groups ਸਮੇਤ — Kafka ਦੀ ਵਰਤੋਂ ਲਈ ਬੁਨਿਆਦੀ ਹੈ।
Producers — events ਲਿਖਣਾ
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
