Kafka ਇੱਕ partition ਦੇ ਅੰਦਰ ਆਰਡਰਿੰਗ ਦੀ ਗਰੰਟੀ ਦਿੰਦਾ ਹੈ ਪਰ partitions ਵਿਚਾਲੇ ਨਹੀਂ — ਇਹ ਇੱਕ ਮਹੱਤਵਪੂਰਨ ਸੰਕਲਪ ਹੈ। ਸਬੰਧਤ ਘਟਨਾਵਾਂ ਲਈ ਆਰਡਰਿੰਗ ਪ੍ਰਾਪਤ ਕਰਨ ਲਈ, ਤੁਸੀਂ ਉਨ੍ਹਾਂ ਨੂੰ ਇੱਕੋ partition ਵਿੱਚ ਰੂਟ ਕਰਦੇ ਹੋ (ਇੱਕੋ key ਦੇ ਰਾਹੀਂ)। ਆਰਡਰਿੰਗ ਨੂੰ ਸਮਝਣਾ ਸਹੀਤਾ ਲਈ ਮਹੱਤਵਪੂਰਨ ਹੈ।
ਪ੍ਰਤੀ-partition ਆਰਡਰਿੰਗ
Kafka guarantees:
✓ ORDER WITHIN a partition → events in a partition are strictly ordered (by offset);
consumers read them in order
✗ NO order ACROSS partitions → events in different partitions have no relative order
guarantee (they're processed in parallel by different consumers)
→ this is a FUNDAMENTAL Kafka property (and a common source of misunderstanding)
