Class EventDataBatch
A set of EventData with size constraints known up-front, intended to be sent to the Event Hubs service in a single operation. When published, the result is atomic; either all events that belong to the batch were successful or all have failed. Partial success is not possible.
Inheritance
Namespace: System.Dynamic.ExpandoObject
Assembly: Azure.Messaging.EventHubs.dll
Syntax
public sealed class EventDataBatch : IDisposable
Remarks
The operations for this class are thread-safe and will prevent changes when
actively being published to the Event Hubs service.
Properties
Count
The count of events contained in the batch.
Declaration
public int Count { get; }
Property Value
System.Int32
|
MaximumSizeInBytes
The maximum size allowed for the batch, in bytes. This includes the events in the batch as well as any overhead for the batch itself when sent to the Event Hubs service.
Declaration
public long MaximumSizeInBytes { get; }
Property Value
System.Int64
|
SizeInBytes
The size of the batch, in bytes, as it will be sent to the Event Hubs service.
Declaration
public long SizeInBytes { get; }
Property Value
System.Int64
|
Methods
Dispose()
Performs the task needed to clean up resources used by the EventDataBatch.
Declaration
public void Dispose ();
TryAdd(EventData)
Attempts to add an event to the batch, ensuring that the size of the batch does not exceed its maximum.
Declaration
public bool TryAdd (Azure.Messaging.EventHubs.EventData eventData);
Parameters
EventData
eventData
The event to attempt to add to the batch. |
Returns
System.Boolean
|
Remarks
When an event is accepted into the batch, changes made to its properties will not be reflected in the batch nor will any state transitions be reflected to the original instance.
Note: Any System.ReadOnlyMemory, byte array, or System.BinaryData instance associated with the event is referenced by the batch and must remain valid and unchanged until the batch is disposed.
Exceptions
System.InvalidOperationException
When a batch is published, it will be locked for the duration of that operation. During this time,
no events may be added to the batch. Calling |
System.Runtime.Serialization.SerializationException
Occurs when the |