PartitionSender PartitionSender PartitionSender Class


This sender class is a logical representation of sending events to a specific EventHub partition. Do not use this class if you do not care about sending events to specific partitions, instead use SendAsync(EventData).

public sealed class PartitionSender : Microsoft.Azure.EventHubs.ClientEntity
type PartitionSender = class
    inherit ClientEntity
Public NotInheritable Class PartitionSender
Inherits ClientEntity


ClientId ClientId ClientId

Gets the client ID.

(Inherited from ClientEntity)
EventHubClient EventHubClient EventHubClient

Gets the EventHubClient associated with this PartitionSender.

PartitionId PartitionId PartitionId

Gets the partition ID for this PartitionSender.

RegisteredPlugins RegisteredPlugins RegisteredPlugins

Gets a list of currently registered plugins for this Client.

(Inherited from ClientEntity)
RetryPolicy RetryPolicy RetryPolicy

Gets the RetryPolicy for the ClientEntity.

(Inherited from ClientEntity)


Close() Close() Close()

Closes the ClientEntity.

(Inherited from ClientEntity)
CloseAsync() CloseAsync() CloseAsync()

Closes and releases resources for the PartitionSender.

CreateBatch() CreateBatch() CreateBatch()

Creates a batch where event data objects can be added for later SendAsync call.

CreateBatch(BatchOptions) CreateBatch(BatchOptions) CreateBatch(BatchOptions)

Creates a batch where event data objects can be added for later SendAsync call.

OnRetryPolicyUpdate() OnRetryPolicyUpdate() OnRetryPolicyUpdate()

Derived entity to override for retry policy updates.

(Inherited from ClientEntity)
RegisterPlugin(EventHubsPlugin) RegisterPlugin(EventHubsPlugin) RegisterPlugin(EventHubsPlugin)

Registers a EventHubsPlugin to be used with this client.

(Inherited from ClientEntity)
SendAsync(EventData) SendAsync(EventData) SendAsync(EventData)

Send EventData to a specific EventHub partition. The target partition is pre-determined when this PartitionSender was created. This send pattern emphasizes data correlation over general availability and latency.

There are 3 ways to send to EventHubs, each exposed as a method (along with its sendBatch overload):

i. SendAsync(EventData) or SendAsync(IEnumerable<EventData>)

ii. SendAsync(EventData, String) or SendAsync(IEnumerable<EventData>, String)

iii. SendAsync(EventData) or SendAsync(IEnumerable<EventData>)

Use this type of send if:

a. The client wants to take direct control of distribution of data across partitions. In this case client is responsible for making sure there is at least one sender per event hub partition.

b. User cannot use partition key as a mean to direct events to specific partition, yet there is a need for data correlation with partitioning scheme.

SendAsync(EventDataBatch) SendAsync(EventDataBatch) SendAsync(EventDataBatch)

Send a batch of EventData in EventDataBatch.

SendAsync(IEnumerable<EventData>) SendAsync(IEnumerable<EventData>) SendAsync(IEnumerable<EventData>)

Send EventData to a specific EventHub partition. The targeted partition is pre-determined when this PartitionSender was created.

There are 3 ways to send to EventHubs, to understand this particular type of send refer to the overload SendAsync(EventData), which is the same type of send and is used to send single EventData.

Sending a batch of EventData's is useful in the following cases:

i. Efficient send - sending a batch of EventData maximizes the overall throughput by optimally using the number of sessions created to EventHubs' service.

ii. Sending multiple EventData's in a Transaction. To acheive ACID properties, the Gateway Service will forward all EventData's in the batch to a single EventHub partition.

UnregisterPlugin(String) UnregisterPlugin(String) UnregisterPlugin(String)

Unregisters a EventHubsPlugin.

(Inherited from ClientEntity)

Applies to

See also