問題文
A payments team requires that all events for a single merchant are processed in the order they occurred, while still processing different merchants in parallel on Apache Kafka on Heroku. Which design satisfies both requirements?
選択肢
- Use a single partition for the topic and increase the number of consumers so that the ordering of the whole topic is preserved while the additional consumers provide the parallelism the team is asking for.
- Increase the number of partitions without choosing a key, because the platform keeps a global order across all partitions of a topic, and every consumer sees the same sequence no matter which partition it reads from.
- Partition the topic and derive the partition key from the merchant identifier, because ordering is guaranteed within a partition but not across partitions.
- Enable compaction on the topic so that only the latest event per merchant remains, which leaves one record per merchant in arrival order for the payments service to replay.