Show / Hide Table of Contents

Class SendEventOptions

The set of options that can be specified to influence the way in which events are published to the Event Hubs service.

Inheritance
System.Object
SendEventOptions
CreateBatchOptions
EnqueueEventOptions
Namespace: System.Dynamic.ExpandoObject
Assembly: Azure.Messaging.EventHubs.dll
Syntax
public class SendEventOptions

Constructors

SendEventOptions()

Initializes a new instance of the SendEventOptions class.

Declaration
public SendEventOptions ();

Properties

PartitionId

If specified, events be published to this specific partition. If the identifier is not specified, Event Hubs will be responsible for assigning events automatically to an available partition.

Declaration
public string PartitionId { get; set; }
Property Value
System.String

The identifier of the desired partition to assign for the events, if null, the events will be automatically assigned to a partition.

The default partition identifier value is null.

Remarks

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

Allowing automatic routing of partitions is recommended when:

  • The sending of events needs to be highly available.
  • The event data should be evenly distributed among all available partitions.

If no partition is specified, the following rules are used for automatically selecting one:

  1. Distribute the events equally amongst all available partitions using a round-robin approach.
  2. If a partition becomes unavailable, the Event Hubs service will automatically detect it and forward the message to another available partition.

PartitionKey

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.

Declaration
public string PartitionKey { get; set; }
Property Value
System.String

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.

Methods

Equals(Object)

Determines whether the specified System.Object is equal to this instance.

Declaration
[System.ComponentModel.EditorBrowsable]
public override bool Equals (object obj);
Parameters
System.Object obj

The System.Object to compare with this instance.

Returns
System.Boolean

true if the specified System.Object is equal to this instance; otherwise, false.

GetHashCode()

Returns a hash code for this instance.

Declaration
[System.ComponentModel.EditorBrowsable]
public override int GetHashCode ();
Returns
System.Int32

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

ToString()

Converts the instance to string representation.

Declaration
[System.ComponentModel.EditorBrowsable]
public override string ToString ();
Returns
System.String

A System.String that represents this instance.

Back to top Azure SDK for .NET