Adam Warski
1 min readMar 6, 2018

--

That’s a very good point — yes, events coming from different partitions can be processed out of order. If you do need events to be globally ordered, than you need to implement a custom Partitioner that will put them in the same partition.

Typically the partitioning is by aggregate root id (an aggregate root can contain multiple entities in its tree), but of course everything depends on the specific use-case.

In general, when dealing with multiple aggregate roots, you have to be prepared for temporal inconsistencies — that’s why these systems are eventually consistent :). That isn’t Kafka-specific — you’ll see that property in all stream-based event-sourcing systems, or even NoSQL databases without transactions.

--

--

Adam Warski

Software engineer, Functional Programming and Scala enthusiast, SoftwareMill co-founder