SendEventOptions.PartitionKey Property

Definition

Allows a hashing key to be provided for the batch of events, which instructs Event Hubs to map the key to an automatically-assigned partition.

The selection of a partition is stable for a given partition key. Should any other events be published using the same exact partition key, Event Hubs will assign the same partition to them.

The partition key should be specified when there is a need to group events together, but the partition to which they are assigned is unimportant. If ensuring that a batch of events is assigned a specific partition, it is recommended that the PartitionId be assigned instead.

public string PartitionKey { get; set; }

Property Value

A value that can be used to identify events that should be published to the same partition. If null, the events will either respect the specified PartitionId or be automatically assigned to a partition.

The default partition key value is null.

Remarks

If the PartitionKey is specified, then no PartitionId may be set when sending.

Applies to