Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
EventDataBatch.TryAdd(EventData) Method
Definition
- Namespace:
- Azure.Messaging.EventHubs.Producer
- Assembly:
- Azure.Messaging.EventHubs.dll
- Package:
- Azure.Messaging.EventHubs v5.12.2
- Package:
- Azure.Messaging.EventHubs v5.12.0-beta.2
- Source:
- EventDataBatch.cs
- Source:
- EventDataBatch.cs
Important
Some information relates to prerelease product that may be substantially modified before itβs released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Attempts to add an event to the batch, ensuring that the size of the batch does not exceed its maximum.
public bool TryAdd(Azure.Messaging.EventHubs.EventData eventData);
member this.TryAdd : Azure.Messaging.EventHubs.EventData -> bool
Public Function TryAdd (eventData As EventData) As Boolean
Parameters
- eventData
- EventData
The event to attempt to add to the batch.
Returns
true if the event was added; otherwise, false.
Exceptions
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 TryAdd while the batch is being published will
result in an InvalidOperationException until publishing has completed.
Occurs when the eventData has a member in its Properties collection that is an
unsupported type for serialization. See the Properties remarks for details.
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 ReadOnlyMemory<T>, byte array, or BinaryData instance associated with the event is referenced by the batch and must remain valid and unchanged until the batch is disposed.
Applies to
Azure SDK for .NET
Feedback
Was this page helpful?
