A developer is configuring a warehouse inventory application that sends real-time stock level updates from multiple warehouses to an Amazon Kinesis Data Stream. To maintain chronological processing order of updates within each warehouse, all records for a specific warehouse must be routed to the same shard. Which approach should the developer use to meet this requirement?
- ASet the partition key to a static string value, such as 'StockUpdate', for all records.
- BIncrease the execution timeout of the consumer Lambda function to match the data stream retention period.
- Set the partition key to the unique warehouse ID for each record.Cevap
- DDeploy the consumer Lambda function in a private subnet without a NAT gateway or VPC endpoint to connect to the Kinesis endpoint.
Cevap
Set the partition key to the unique warehouse ID for each record.
The correct answer is to set the partition key to the unique warehouse ID for each record. Amazon Kinesis Data Streams uses the partition key to determine which shard a record is assigned to. By using the warehouse ID as the partition key, all records associated with a specific warehouse will have the same hash value and will be sent to the same shard. This guarantees that they are processed in the strict chronological order in which they were received.
Adım Adım Çözüm
Anahtar Kavram
Kinesis Data Streams uses the partition key to group data records and determine which shard they are routed to, ensuring ordered processing within that shard.
Tahmini Süre:1m 0s