You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Event Hubs Client] Publish Events Without Batch (#11651)
The focus of these changes is to allow the publishing of events without the
overhead of creating an explicit batch. In this scenario the caller assumes
the risk with respect to exceeding the maximum size allowed by the Event Hubs
service, trading safety for lower overhead and higher throughput.
/// behaves and is sent to the Event Hubs service.
12
12
/// </summary>
13
13
///
14
-
publicclassCreateBatchOptions
14
+
publicclassCreateBatchOptions:SendEventOptions
15
15
{
16
16
/// <summary>The requested maximum size to allow for the batch, in bytes.</summary>
17
17
privatelong?_maximumSizeInBytes=null;
@@ -40,58 +40,6 @@ public long? MaximumSizeInBytes
40
40
}
41
41
}
42
42
43
-
/// <summary>
44
-
/// Allows a hashing key to be provided for the batch of events, which instructs the Event Hubs
45
-
/// service map this key to a specific partition but allowing the service to choose an arbitrary,
46
-
/// partition for this batch of events and any other batches using the same partition hashing key.
47
-
///
48
-
/// The selection of a partition is stable for a given partition hashing key. Should any other
49
-
/// batches of events be sent using the same exact partition hashing key, the Event Hubs service will
50
-
/// route them all to the same partition.
51
-
///
52
-
/// This should be specified only when there is a need to group events by partition, but there is
53
-
/// flexibility into which partition they are routed. If ensuring that a batch of events is sent
54
-
/// only to a specific partition, it is recommended that the identifier of the position be
55
-
/// specified directly when sending the batch.
56
-
/// </summary>
57
-
///
58
-
/// <value>
59
-
/// If the producer wishes to influence the automatic routing of events to partitions, the partition
60
-
/// hashing key to associate with the event or batch of events; otherwise, <c>null</c>.
61
-
/// </value>
62
-
///
63
-
/// <remarks>
64
-
/// If the <see cref="CreateBatchOptions.PartitionKey" /> is specified, then no <see cref="CreateBatchOptions.PartitionId" />
65
-
/// may be set when sending.
66
-
/// </remarks>
67
-
///
68
-
publicstringPartitionKey{get;set;}
69
-
70
-
/// <summary>
71
-
/// If specified, events will be published to this specific partition. If the identifier is not
72
-
/// specified, the Event Hubs service will be responsible for routing events automatically to an available partition.
73
-
/// </summary>
74
-
///
75
-
/// <value>
76
-
/// If the producer wishes the events to be automatically routed to partitions, <c>null</c>; otherwise, the identifier
77
-
/// of the desired partition.
78
-
/// </value>
79
-
///
80
-
/// <remarks>
81
-
/// If the <see cref="CreateBatchOptions.PartitionId" /> is specified, then no <see cref="CreateBatchOptions.PartitionKey" />
82
-
/// may be set when sending.
83
-
///
84
-
/// <para>Allowing automatic routing of partitions is recommended when:</para>
85
-
/// <para>- The sending of events needs to be highly available.</para>
86
-
/// <para>- The event data should be evenly distributed among all available partitions.</para>
87
-
///
88
-
/// If no partition is specified, the following rules are used for automatically selecting one:
89
-
/// <para>1) Distribute the events equally amongst all available partitions using a round-robin approach.</para>
90
-
/// <para>2) If a partition becomes unavailable, the Event Hubs service will automatically detect it and forward the message to another available partition.</para>
91
-
/// </remarks>
92
-
///
93
-
publicstringPartitionId{get;set;}
94
-
95
43
/// <summary>
96
44
/// Creates a new copy of the current <see cref="CreateBatchOptions" />, cloning its attributes into a new instance.
/// Sends a set of events to the associated Event Hub using a batched approach. If the size of events exceed the
374
-
/// maximum size of a single batch, an exception will be triggered and the send will fail.
373
+
/// Sends a set of events to the associated Event Hub using a batched approach. Because the batch is implicitly created, the size of the event set is not
374
+
/// validated until this method is invoked. The call will fail if the size of the specified set of events exceeds the maximum allowable size of a single batch.
375
375
/// </summary>
376
376
///
377
-
/// <param name="events">The set of event data to send.</param>
377
+
/// <param name="eventBatch">The set of event data to send.</param>
378
378
/// <param name="cancellationToken">An optional <see cref="CancellationToken" /> instance to signal the request to cancel the operation.</param>
379
379
///
380
380
/// <returns>A task to be resolved on when the operation has completed.</returns>
/// Occurs when the set of events exceeds the maximum size allowed in a single batch, as determined by the Event Hubs service. The <see cref="EventHubsException.Reason" /> will be set to
384
+
/// <see cref="EventHubsException.FailureReason.MessageSizeExceeded"/> in this case.
/// Sends a set of events to the associated Event Hub using a batched approach. If the size of events exceed the
389
-
/// maximum size of a single batch, an exception will be triggered and the send will fail.
395
+
/// Sends a set of events to the associated Event Hub using a batched approach. Because the batch is implicitly created, the size of the event set is not
396
+
/// validated until this method is invoked. The call will fail if the size of the specified set of events exceeds the maximum allowable size of a single batch.
390
397
/// </summary>
391
398
///
392
-
/// <param name="events">The set of event data to send.</param>
399
+
/// <param name="eventBatch">The set of event data to send.</param>
393
400
/// <param name="options">The set of options to consider when sending this batch.</param>
394
401
/// <param name="cancellationToken">An optional <see cref="CancellationToken" /> instance to signal the request to cancel the operation.</param>
395
402
///
396
403
/// <returns>A task to be resolved on when the operation has completed.</returns>
/// Occurs when the set of events exceeds the maximum size allowed in a single batch, as determined by the Event Hubs service. The <see cref="EventHubsException.Reason" /> will be set to
407
+
/// <see cref="EventHubsException.FailureReason.MessageSizeExceeded"/> in this case.
0 commit comments