Telemetry from each vehicle must reach one partition in the order it was sent, so a single consumer can process a given vehicle's readings sequentially. How should the publisher route each event?
Show answer and explanation
Answer: B
A partition key is hashed to choose a partition, so every event that shares the same key goes to the same partition. A consumer reads a partition in the order events were written, which keeps each vehicle's readings sequential. The key is set on the publishing side. Random partition selection would scatter a vehicle's events, consumer groups do not affect where events are placed, and one hub per vehicle is impractical across a fleet.
Why the other options are wrong
- A. Random partition selection scatters one vehicle's readings across several partitions, so their relative order is lost for any single consumer.
- C. Consumer groups define independent views of the stream for readers. They have no effect on where a publisher's events are placed in partitions.
- D. Creating one event hub per vehicle is impractical at fleet scale and is not how partitioning is meant to be used. A partition key achieves the same ordering with one hub.