Middle
How was the issue of event ordering in Kafka (ordering) addressed for entity audit trail?
sobes.tech AI
Answer from AI
In Kafka, the order of events is guaranteed within a single partition but not across different partitions. For audit trail purposes per entity, message keys are usually used so that all events of one entity go to the same partition, maintaining order. If there are many entities and scalability is needed, keys based on entity identifiers can be used to distribute the load, while preserving order for each entity. Sometimes, additional logic on the consumer side is also applied to order events if they come from different partitions.