Table of Contents

Class EventHubSender

Namespace
Microsoft.ServiceBus.Messaging
Assembly
Microsoft.ServiceBus.dll

A client class used in send operations for an Event Hub. Represents a logical sender connection to a specific Event Hub partition.

public sealed class EventHubSender : ClientEntity
Inheritance
EventHubSender
Inherited Members

Properties

PartitionId

Gets the partition ID for a logical partition of an Event Hub.

public string PartitionId { get; }

Property Value

string

The partition identifier.

Path

Gets the path of the Event Hub.

public string Path { get; }

Property Value

string

The Event Hub path.

Methods

CreateFromConnectionString(string)

public static EventHubSender CreateFromConnectionString(string connectionString)

Parameters

connectionString string

Returns

EventHubSender

OnAbort()

protected override void OnAbort()

OnBeginClose(TimeSpan, AsyncCallback, object)

protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)

Parameters

timeout TimeSpan
callback AsyncCallback
state object

Returns

IAsyncResult

Returns IAsyncResult.

OnBeginOpen(TimeSpan, AsyncCallback, object)

protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)

Parameters

timeout TimeSpan
callback AsyncCallback
state object

Returns

IAsyncResult

Returns IAsyncResult.

OnClose(TimeSpan)

protected override void OnClose(TimeSpan timeout)

Parameters

timeout TimeSpan

OnEndClose(IAsyncResult)

protected override void OnEndClose(IAsyncResult result)

Parameters

result IAsyncResult

OnEndOpen(IAsyncResult)

protected override void OnEndOpen(IAsyncResult result)

Parameters

result IAsyncResult

OnOpen(TimeSpan)

protected override void OnOpen(TimeSpan timeout)

Parameters

timeout TimeSpan

Send(EventData)

Sends event data to the logical partition represented by PartitionId.

public void Send(EventData data)

Parameters

data EventData

The EventData to send.

SendAsync(EventData)

Asynchronous version of Send(EventData).

public Task SendAsync(EventData data)

Parameters

data EventData

The EventData to send.

Returns

Task

The task representing the asynchronous operation.

SendBatch(IEnumerable<EventData>)

Sends a batch of event data to the logical partition represented by PartitionId.

public void SendBatch(IEnumerable<EventData> eventDataList)

Parameters

eventDataList IEnumerable<EventData>

An System.Collections.Generic.IEnumerable object containing event data instances.

Exceptions

MessageSizeExceededException

Thrown if the total serialized size of eventDataList exceeds the allowed size limit for one event transmission (256k by default).

SendBatchAsync(IEnumerable<EventData>)

Asynchronously sends a batch of event data to the logical partition represented by PartitionId.

public Task SendBatchAsync(IEnumerable<EventData> eventDataList)

Parameters

eventDataList IEnumerable<EventData>

An System.Collections.Generic.IEnumerable object containing event data instances.

Returns

Task

Returns Task.

Exceptions

MessageSizeExceededException

Thrown if the total serialized size of eventDataList exceeds the allowed size limit for one event transmission (256k by default).