Parallelism and ordering

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 guaranteed 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.

  • One of the solution is to use SEDA queue. Camel has a dedicated page on Parallelism and ordering

  • There is whitepaper titles A Scalable Architecture for Ordered Parallelism I haven’t gone through it yet.

    Are there other methods to handle the ordering while processing the messages in parallel?