Delegate PartitionerDelegate
Calculate a partition number given a partitionCount
and serialized keyData
. The topic
is also provided, but is typically not used.
Namespace: Confluent.Kafka
Assembly: cs.temp.dll.dll
Syntax
public delegate Partition PartitionerDelegate(string topic, int partitionCount, ReadOnlySpan<byte> keyData, bool keyIsNull);
Parameters
Type | Name | Description |
---|---|---|
System.String | topic | The topic. |
System.Int32 | partitionCount | The number of partitions in |
ReadOnlySpan<System.Byte> | keyData | The serialized key data. |
System.Boolean | keyIsNull | Whether or not the key is null (distinguishes the null and empty case). |
Returns
Type | Description |
---|---|
Partition |
Remarks
A partioner instance may be called in any thread at any time and may be called multiple times for the same message/key.
A partitioner:
- MUST NOT call any method on the producer instance.
- MUST NOT block or execute for prolonged periods of time.
- MUST return a value between 0 and partitionCnt-1.
- MUST NOT throw any exception.