Kafka doesn't guarantee ordering when you don't specify a message key. Why?
Ordering is only guaranteed per partition because, in a consumer group with multiple instances, Kafka guarantees that each partition will be processed by a single instance from each consumer group.
When you use a message key, the messages with the same key will be produced in the same partition (you can take a look at the default producer algorithm when using a meesage key that's based on a hash calculated by a called "murmur2" algorithm)