Question

Difficulty: EasyStream Processing and Event Routing with Amazon Kinesis and EventBridge

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?

  1. A
    Set the partition key to a static string value, such as 'StockUpdate', for all records.
  2. B
    Increase the execution timeout of the consumer Lambda function to match the data stream retention period.
  3. Set the partition key to the unique warehouse ID for each record.Answer
  4. D
    Deploy the consumer Lambda function in a private subnet without a NAT gateway or VPC endpoint to connect to the Kinesis endpoint.

Answer

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.

Step-by-Step Solution

1
Identify the requirement to route records for the same warehouse to the same shard to ensure chronological ordering.
Determine that Kinesis uses partition keys to group related data onto the same shard.
Kinesis guarantees in-order processing only for records written to the same shard.
2
Evaluate the options for partition key design to select a high-entropy attribute that maps to the warehouse grouping.
Selecting the unique warehouse ID as the partition key ensures warehouse-specific ordering and distributes records across shards.
A unique key ensures sequential processing per warehouse while preventing hot shards.

Key Concept

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.
Estimated Time:1m 0s
Rate this question