@PublicEvolving public class UniformShardAssigner extends Object implements KinesisShardAssigner
KinesisShardAssignerthat maps Kinesis shard hash-key ranges to Flink subtasks. It creates a more uniform distribution of shards across subtasks than
KinesisDataFetcher.DEFAULT_SHARD_ASSIGNERwhen the Kinesis records in the stream have hash keys that are uniformly distributed over all possible hash keys, which is the case if records have randomly-generated partition keys. (This is the same assumption made if you use the Kinesis UpdateShardCount operation with UNIFORM_SCALING.)
|Constructor and Description|
|Modifier and Type||Method and Description|
Returns the index of the target subtask that a specific shard should be assigned to.
public int assign(StreamShardHandle streamShardHandle, int nSubtasks)
The resulting distribution of shards should have the following contract:
The above contract is crucial and cannot be broken. Consumer subtasks rely on this contract to filter out shards that they should not subscribe to, guaranteeing that each shard of a stream will always be assigned to one subtask in a uniformly distributed manner.
streamShardHandle- the shard to determine
nSubtasks- total number of subtasks
Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.