I could think of two ways to handle it with Kafka.
- Single partition for a topic.
You could have only one partition and a consumer that can process messages. Issue would be blocking parallelism processing and bottleneck in performance.
- You may have multiple partitions, and producer can insert messages to a specific partition based on a hash outcome.
For ex. if you want to make sure a messages for a specific domains are processed in the order, Producer can decide a partition based on a domain value. So all the messages for a particular domain go to same partition, will be processed by the same consumer in order.
Possible issue with this approach is uneven data distribution.