Skip to content

Commit f52c5e7

Browse files
Service Bus extension API updates (Azure#22475)
* Service Bus extension API updates * MaxEventBatchSize
1 parent e86f662 commit f52c5e7

18 files changed

+60
-69
lines changed

sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/CHANGELOG.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
# Release History
22

3-
## 5.0.0-beta.7 (Unreleased)
4-
5-
### Features Added
3+
## 5.0.0-beta.7 (2021-07-07)
64

75
### Breaking Changes
86

9-
### Key Bugs Fixed
10-
11-
### Fixed
12-
7+
- Renamed `MaxBatchSize` to `MaxEventBatchSize` in `EventHubsOptions`.
138

149
## 5.0.0-beta.6 (2021-06-09)
1510

sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/api/Microsoft.Azure.WebJobs.Extensions.EventHubs.netstandard2.0.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public EventHubOptions() { }
2828
public System.Uri CustomEndpointAddress { get { throw null; } set { } }
2929
public Microsoft.Azure.WebJobs.EventHubs.InitialOffsetOptions InitialOffsetOptions { get { throw null; } }
3030
public System.TimeSpan LoadBalancingUpdateInterval { get { throw null; } set { } }
31-
public int MaxBatchSize { get { throw null; } set { } }
31+
public int MaxEventBatchSize { get { throw null; } set { } }
3232
public System.TimeSpan PartitionOwnershipExpirationInterval { get { throw null; } set { } }
3333
public int PrefetchCount { get { throw null; } set { } }
3434
public long? PrefetchSizeInBytes { get { throw null; } set { } }

sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/src/Config/EventHubClientFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ internal EventProcessorHost GetEventProcessorHost(string eventHubName, string co
101101
eventHubName: eventHubName,
102102
credential: info.TokenCredential,
103103
options: _options.EventProcessorOptions,
104-
eventBatchMaximumCount: _options.MaxBatchSize,
104+
eventBatchMaximumCount: _options.MaxEventBatchSize,
105105
exceptionHandler: _options.ExceptionHandler);
106106
}
107107

108108
return new EventProcessorHost(consumerGroup: consumerGroup,
109109
connectionString: NormalizeConnectionString(info.ConnectionString, eventHubName),
110110
eventHubName: eventHubName,
111111
options: _options.EventProcessorOptions,
112-
eventBatchMaximumCount: _options.MaxBatchSize,
112+
eventBatchMaximumCount: _options.MaxEventBatchSize,
113113
exceptionHandler: _options.ExceptionHandler);
114114
}
115115

sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/src/Config/EventHubOptions.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class EventHubOptions : IOptionsFormatter
1818
{
1919
public EventHubOptions()
2020
{
21-
MaxBatchSize = 10;
21+
MaxEventBatchSize = 10;
2222
ConnectionOptions = new EventHubConnectionOptions()
2323
{
2424
TransportType = EventHubsTransportType.AmqpTcp
@@ -112,22 +112,22 @@ public int BatchCheckpointFrequency
112112
}
113113
}
114114

115-
private int _maxBatchSize;
115+
private int _maxEventBatchSize;
116116

117117
/// <summary>
118118
/// Gets or sets the maximum number of events delivered in a batch. Default 10.
119119
/// </summary>
120-
public int MaxBatchSize
120+
public int MaxEventBatchSize
121121
{
122-
get => _maxBatchSize;
122+
get => _maxEventBatchSize;
123123

124124
set
125125
{
126126
if (value < 1)
127127
{
128128
throw new ArgumentException("Batch size must be larger than 0.");
129129
}
130-
_maxBatchSize = value;
130+
_maxEventBatchSize = value;
131131
}
132132
}
133133

@@ -187,7 +187,7 @@ string IOptionsFormatter.Format()
187187
{
188188
JObject options = new JObject
189189
{
190-
{ nameof(MaxBatchSize), MaxBatchSize },
190+
{ nameof(MaxEventBatchSize), MaxEventBatchSize },
191191
{ nameof(BatchCheckpointFrequency), BatchCheckpointFrequency },
192192
{ nameof(TransportType), TransportType.ToString()},
193193
{ nameof(WebProxy), WebProxy is WebProxy proxy ? proxy.Address.AbsoluteUri : string.Empty },

sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/src/Config/EventHubWebJobsBuilderExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public static IWebJobsBuilder AddEventHubs(this IWebJobsBuilder builder, Action<
4848
"EventProcessorOptions:EnableReceiverRuntimeMetric",
4949
options.TrackLastEnqueuedEventProperties);
5050

51-
options.MaxBatchSize = section.GetValue(
51+
options.MaxEventBatchSize = section.GetValue(
5252
"EventProcessorOptions:MaxBatchSize",
53-
options.MaxBatchSize);
53+
options.MaxEventBatchSize);
5454

5555
options.PrefetchCount = section.GetValue(
5656
"EventProcessorOptions:PrefetchCount",

sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/tests/EventHubConfigurationTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void ConfigureOptions_AppliesValuesCorrectly()
3838
{
3939
EventHubOptions options = CreateOptionsFromConfig();
4040

41-
Assert.AreEqual(123, options.MaxBatchSize);
41+
Assert.AreEqual(123, options.MaxEventBatchSize);
4242
Assert.AreEqual(true, options.EventProcessorOptions.TrackLastEnqueuedEventProperties);
4343
Assert.AreEqual(123, options.EventProcessorOptions.PrefetchCount);
4444
Assert.AreEqual(5, options.BatchCheckpointFrequency);
@@ -69,7 +69,7 @@ public void ConfigureOptions_Format_Returns_Expected()
6969
b => { b.AddEventHubs(); },
7070
jsonStream: new BinaryData(jObject.ToString()).ToStream());
7171

72-
Assert.AreEqual(123, result.MaxBatchSize);
72+
Assert.AreEqual(123, result.MaxEventBatchSize);
7373
Assert.AreEqual(5, result.BatchCheckpointFrequency);
7474
Assert.True(result.TrackLastEnqueuedEventProperties);
7575
Assert.AreEqual(123, result.PrefetchCount);
@@ -92,7 +92,7 @@ public void ConfigureOptions_AppliesValuesCorrectly_BackCompat()
9292
{
9393
EventHubOptions options = CreateOptionsFromConfigBackCompat();
9494

95-
Assert.AreEqual(123, options.MaxBatchSize);
95+
Assert.AreEqual(123, options.MaxEventBatchSize);
9696
Assert.AreEqual(true, options.EventProcessorOptions.TrackLastEnqueuedEventProperties);
9797
Assert.AreEqual(123, options.EventProcessorOptions.PrefetchCount);
9898
Assert.AreEqual(5, options.BatchCheckpointFrequency);
@@ -116,7 +116,7 @@ public void ConfigureOptions_Format_Returns_Expected_BackCompat()
116116
b => { b.AddEventHubs(); },
117117
jsonStream: new BinaryData(jObject.ToString()).ToStream());
118118

119-
Assert.AreEqual(123, result.MaxBatchSize);
119+
Assert.AreEqual(123, result.MaxEventBatchSize);
120120
Assert.AreEqual(5, result.BatchCheckpointFrequency);
121121
Assert.True(result.TrackLastEnqueuedEventProperties);
122122
Assert.AreEqual(123, result.PrefetchCount);
@@ -219,7 +219,7 @@ private EventHubOptions CreateOptionsFromConfig()
219219
string extensionPath = "AzureWebJobs:Extensions:EventHubs";
220220
var values = new Dictionary<string, string>
221221
{
222-
{ $"{extensionPath}:MaxBatchSize", "123" },
222+
{ $"{extensionPath}:MaxEventBatchSize", "123" },
223223
{ $"{extensionPath}:TrackLastEnqueuedEventProperties", "true" },
224224
{ $"{extensionPath}:PrefetchCount", "123" },
225225
{ $"{extensionPath}:BatchCheckpointFrequency", "5" },

sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/tests/EventHubTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public void InitializeFromHostMetadata()
205205
var eventProcessorOptions = options.EventProcessorOptions;
206206
Assert.AreEqual(200, eventProcessorOptions.PrefetchCount);
207207
Assert.AreEqual(5, options.BatchCheckpointFrequency);
208-
Assert.AreEqual(100, options.MaxBatchSize);
208+
Assert.AreEqual(100, options.MaxEventBatchSize);
209209
Assert.AreEqual(31, options.EventProcessorOptions.PartitionOwnershipExpirationInterval.TotalSeconds);
210210
Assert.AreEqual(21, options.EventProcessorOptions.LoadBalancingUpdateInterval.TotalSeconds);
211211
Assert.AreEqual(EventPosition.Latest, eventProcessorOptions.DefaultStartingPosition);

sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/CHANGELOG.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
# Release History
22

3-
## 5.0.0-beta.5 (Unreleased)
4-
5-
### Features Added
3+
## 5.0.0-beta.5 (2021-07-07)
64

75
### Breaking Changes
8-
9-
### Key Bugs Fixed
10-
11-
### Fixed
12-
6+
- Renamed `ServiceBusEntityType` property to `EntityType`.
7+
- Renamed `messageActions` and `sessionActions` parameters to `actions` in `MessageProcessor` and `SessionMessageProcessor`.
8+
- Renamed `MaxBatchSize` to `MaxMessageBatchSize` in `ServiceBusOptions`.
139

1410
## 5.0.0-beta.4 (2021-06-22)
1511

sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/api/Microsoft.Azure.WebJobs.Extensions.ServiceBus.netstandard2.0.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ public ServiceBusAccountAttribute(string account) { }
1313
[System.Diagnostics.DebuggerDisplayAttribute("{QueueOrTopicName,nq}")]
1414
public sealed partial class ServiceBusAttribute : System.Attribute, Microsoft.Azure.WebJobs.IConnectionProvider
1515
{
16-
public ServiceBusAttribute(string queueOrTopicName, Microsoft.Azure.WebJobs.ServiceBus.ServiceBusEntityType serviceBusEntityType = Microsoft.Azure.WebJobs.ServiceBus.ServiceBusEntityType.Queue) { }
16+
public ServiceBusAttribute(string queueOrTopicName, Microsoft.Azure.WebJobs.ServiceBus.ServiceBusEntityType entityType = Microsoft.Azure.WebJobs.ServiceBus.ServiceBusEntityType.Queue) { }
1717
public string Connection { get { throw null; } set { } }
18+
public Microsoft.Azure.WebJobs.ServiceBus.ServiceBusEntityType EntityType { get { throw null; } set { } }
1819
public string QueueOrTopicName { get { throw null; } }
19-
public Microsoft.Azure.WebJobs.ServiceBus.ServiceBusEntityType ServiceBusEntityType { get { throw null; } set { } }
2020
}
2121
[Microsoft.Azure.WebJobs.ConnectionProviderAttribute(typeof(Microsoft.Azure.WebJobs.ServiceBusAccountAttribute))]
2222
[Microsoft.Azure.WebJobs.Description.BindingAttribute]
@@ -40,8 +40,8 @@ public partial class MessageProcessor
4040
{
4141
public MessageProcessor(Azure.Messaging.ServiceBus.ServiceBusProcessor processor) { }
4242
protected internal Azure.Messaging.ServiceBus.ServiceBusProcessor Processor { get { throw null; } }
43-
protected internal virtual System.Threading.Tasks.Task<bool> BeginProcessingMessageAsync(Microsoft.Azure.WebJobs.ServiceBus.ServiceBusMessageActions messageActions, Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, System.Threading.CancellationToken cancellationToken) { throw null; }
44-
protected internal virtual System.Threading.Tasks.Task CompleteProcessingMessageAsync(Microsoft.Azure.WebJobs.ServiceBus.ServiceBusMessageActions messageActions, Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, Microsoft.Azure.WebJobs.Host.Executors.FunctionResult result, System.Threading.CancellationToken cancellationToken) { throw null; }
43+
protected internal virtual System.Threading.Tasks.Task<bool> BeginProcessingMessageAsync(Microsoft.Azure.WebJobs.ServiceBus.ServiceBusMessageActions actions, Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, System.Threading.CancellationToken cancellationToken) { throw null; }
44+
protected internal virtual System.Threading.Tasks.Task CompleteProcessingMessageAsync(Microsoft.Azure.WebJobs.ServiceBus.ServiceBusMessageActions actions, Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, Microsoft.Azure.WebJobs.Host.Executors.FunctionResult result, System.Threading.CancellationToken cancellationToken) { throw null; }
4545
}
4646
public partial class MessagingProvider
4747
{
@@ -77,9 +77,9 @@ public ServiceBusOptions() { }
7777
public System.Func<Azure.Messaging.ServiceBus.ProcessErrorEventArgs, System.Threading.Tasks.Task> ExceptionHandler { get { throw null; } set { } }
7878
public Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { throw null; } set { } }
7979
public System.TimeSpan MaxAutoLockRenewalDuration { get { throw null; } set { } }
80-
public int MaxBatchSize { get { throw null; } set { } }
8180
public int MaxConcurrentCalls { get { throw null; } set { } }
8281
public int MaxConcurrentSessions { get { throw null; } set { } }
82+
public int MaxMessageBatchSize { get { throw null; } set { } }
8383
public int PrefetchCount { get { throw null; } set { } }
8484
public System.TimeSpan? SessionIdleTimeout { get { throw null; } set { } }
8585
public Azure.Messaging.ServiceBus.ServiceBusTransportType TransportType { get { throw null; } set { } }
@@ -96,8 +96,8 @@ public partial class SessionMessageProcessor
9696
{
9797
public SessionMessageProcessor(Azure.Messaging.ServiceBus.ServiceBusSessionProcessor processor) { }
9898
protected internal Azure.Messaging.ServiceBus.ServiceBusSessionProcessor Processor { get { throw null; } }
99-
public virtual System.Threading.Tasks.Task<bool> BeginProcessingMessageAsync(Microsoft.Azure.WebJobs.ServiceBus.ServiceBusSessionMessageActions sessionActions, Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, System.Threading.CancellationToken cancellationToken) { throw null; }
100-
public virtual System.Threading.Tasks.Task CompleteProcessingMessageAsync(Microsoft.Azure.WebJobs.ServiceBus.ServiceBusSessionMessageActions sessionActions, Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, Microsoft.Azure.WebJobs.Host.Executors.FunctionResult result, System.Threading.CancellationToken cancellationToken) { throw null; }
99+
public virtual System.Threading.Tasks.Task<bool> BeginProcessingMessageAsync(Microsoft.Azure.WebJobs.ServiceBus.ServiceBusSessionMessageActions actions, Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, System.Threading.CancellationToken cancellationToken) { throw null; }
100+
public virtual System.Threading.Tasks.Task CompleteProcessingMessageAsync(Microsoft.Azure.WebJobs.ServiceBus.ServiceBusSessionMessageActions actions, Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, Microsoft.Azure.WebJobs.Host.Executors.FunctionResult result, System.Threading.CancellationToken cancellationToken) { throw null; }
101101
}
102102
}
103103
namespace Microsoft.Extensions.Hosting

sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/src/Bindings/ServiceBusBinding.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public async Task<IValueProvider> BindAsync(BindingContext context)
5353
var entity = new ServiceBusEntity
5454
{
5555
MessageSender = messageSender,
56-
ServiceBusEntityType = _attribute.ServiceBusEntityType,
56+
ServiceBusEntityType = _attribute.EntityType,
5757
};
5858

5959
return await BindAsync(entity, context.ValueContext).ConfigureAwait(false);

0 commit comments

Comments
 (0)