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
CreateBatch()
Creates a batch where event data objects can be added for later SendBatch or SendBatchAsync call.
public EventDataBatch CreateBatch()
Returns
- EventDataBatch
Returns EventDataBatch.
CreateFromConnectionString(string)
Creates a new instance of EventHubSender using the supplied connection string. Intended to be used to send using a ConnectionString with SharedAcessSignature and Publisher.
public static EventHubSender CreateFromConnectionString(string connectionString)
Parameters
connectionString
stringThe connection string used.
Returns
- EventHubSender
The created EventHubSender
Remarks
The connection can be obtained either from the Azure portal, or created from a ServiceBusConnectionStringBuilder instance.
OnAbort()
protected override void OnAbort()
OnBeginClose(TimeSpan, AsyncCallback, object)
protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
Parameters
timeout
TimeSpancallback
AsyncCallbackstate
object
Returns
- IAsyncResult
Returns IAsyncResult.
OnBeginOpen(TimeSpan, AsyncCallback, object)
protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
Parameters
timeout
TimeSpancallback
AsyncCallbackstate
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
SendAsync(EventData)
Asynchronous version of Send(EventData).
public Task SendAsync(EventData data)
Parameters
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 IEnumerable object containing event data instances.
Remarks
User should make sure the total serialized size of eventDataList
should be
under the size limit of one event data transmission, which is 256k by default.
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 IEnumerable object containing event data instances.
Returns
Remarks
User should make sure the total serialized size of eventDataList
should be
under the size limit of one event data transmission, which is 256k by default.
Exceptions
- MessageSizeExceededException
Thrown if the total serialized size of
eventDataList
exceeds the allowed size limit for one event transmission (256k by default).