One of the disadvantages of microservice event based architectures is that there is lot of parallel processing of a single entity across multiple modules.
There are many cases we want the parallelism but at the same time, want the messages to be processed in ordered manner.
There are several design pattern to solve this problem:
Kafka solves this through partitions. A topic can be split into partitions. Messages are gauranteed to be in order within a single partition. You can have multiple consumers consuming from each partition separately providing for scalability and ordering. This design assumes that each consumer is single threaded and processing the messages one after other. In practical, scenarios this is usually not the case.
There is whitepaper titles A Scalable Architecture for Ordered Parallelism
I havn't gone thorugh it yet.
Are there other methods to handle the ordering while processing the messages in parallel? Let me know in the comments...