(no title)
reader_1000 | 4 years ago
If order of message processing matters, then Kafka is better suited then AMQP. For example, In a distributed application for money transfers, if AMQP used, message order will be lost and some problems will occur in the following scenario:
User A with an accound of $1000 makes order for two transfers T1 ($600) and T2 ($500)
- Rabbit delivers T1 to server1, before processing message, server1 enters a full GC.
- Rabbit delivers T2 to server2 and server2 processes message immediately, now User A's account have $500
- Server1 resumes its life after the end of GC, but fails to process T1 since account's balance is less than required amount.
However, it is T2 that should have failed because User A ordered T1 first and T2 after.In Kafka, when user account identifier is used for partitioning key, all User A's messages will be processed by same consumer (i.e server1), so even if server1 enters a full GC, that is OK, since T2 will be processed after T1.
Serow225|4 years ago