Skip to content

Commit 38d9ded

Browse files
authored
[Event Hubs] Event Source Fixes (Azure#32882)
The focus of these changes is to correct a typo for message parameter within the event source and to attempt to improve reliability for tests that mock the event source by removing base class delegation for calls.
1 parent be8dbd1 commit 38d9ded

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

sdk/eventhub/Azure.Messaging.EventHubs.Processor/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
### Bugs Fixed
1010

11+
- Corrected log message issue causing formatting to fail when developer code for processing events leaks an exception. This obscured the warning that was intended to be emitted to the error handler.
12+
1113
### Other Changes
1214

1315
## 5.7.5 (2022-11-22)

sdk/eventhub/Azure.Messaging.EventHubs/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
### Bugs Fixed
1010

11+
- Corrected log message issue causing formatting to fail when developer code for processing events leaks an exception. This obscured the warning that was intended to be emitted to the error handler.
12+
1113
### Other Changes
1214

1315
## 5.7.5 (2022-11-22)

sdk/eventhub/Azure.Messaging.EventHubs/src/Diagnostics/EventHubsEventSource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2601,7 +2601,7 @@ public virtual void EventProcessorProcessingHandlerError(string partitionId,
26012601
{
26022602
if (IsEnabled())
26032603
{
2604-
WriteEvent(125, partitionId ?? string.Empty, identifier ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty, errorMessage ?? string.Empty);
2604+
WriteEvent(125, partitionId ?? string.Empty, identifier ?? string.Empty, eventHubName ?? string.Empty, consumerGroup ?? string.Empty, operationId ?? string.Empty, errorMessage ?? string.Empty);
26052605
}
26062606
}
26072607

sdk/eventhub/Azure.Messaging.EventHubs/tests/Primitives/EventProcessorTests.StartStop.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ public async Task StartProcessingLogsNormalStartup(bool async)
480480
using var cancellationSource = new CancellationTokenSource();
481481
cancellationSource.CancelAfter(EventHubsTestEnvironment.Instance.TestExecutionTimeLimit);
482482

483-
var mockEventSource = new Mock<EventHubsEventSource>() { CallBase = true };
483+
var mockEventSource = new Mock<EventHubsEventSource>();
484484
var mockProcessor = new Mock<MinimalProcessorMock>(4, "consumerGroup", "namespace", "eventHub", Mock.Of<TokenCredential>(), default(EventProcessorOptions)) { CallBase = true };
485485

486486
mockProcessor.Object.Logger = mockEventSource.Object;
@@ -533,7 +533,7 @@ public async Task StartProcessingLogsErrorDuringStartup(bool async)
533533
using var cancellationSource = new CancellationTokenSource();
534534
cancellationSource.CancelAfter(EventHubsTestEnvironment.Instance.TestExecutionTimeLimit);
535535

536-
var mockEventSource = new Mock<EventHubsEventSource>() { CallBase = true };
536+
var mockEventSource = new Mock<EventHubsEventSource>();
537537
var mockProcessor = new Mock<MinimalProcessorMock>(4, "consumerGroup", "namespace", "eventHub", Mock.Of<TokenCredential>(), default(EventProcessorOptions)) { CallBase = true };
538538

539539
mockEventSource
@@ -1182,7 +1182,7 @@ public async Task StopProcessingLogsNormalShutdown(bool async)
11821182
using var cancellationSource = new CancellationTokenSource();
11831183
cancellationSource.CancelAfter(EventHubsTestEnvironment.Instance.TestExecutionTimeLimit);
11841184

1185-
var mockEventSource = new Mock<EventHubsEventSource>() { CallBase = true };
1185+
var mockEventSource = new Mock<EventHubsEventSource>();
11861186
var mockProcessor = new Mock<MinimalProcessorMock>(4, "consumerGroup", "namespace", "eventHub", Mock.Of<TokenCredential>(), default(EventProcessorOptions)) { CallBase = true };
11871187

11881188
mockProcessor.Object.Logger = mockEventSource.Object;
@@ -1235,7 +1235,7 @@ public async Task StopProcessingLogsErrorDuringShutdown(bool async)
12351235
using var cancellationSource = new CancellationTokenSource();
12361236
cancellationSource.CancelAfter(EventHubsTestEnvironment.Instance.TestExecutionTimeLimit);
12371237

1238-
var mockEventSource = new Mock<EventHubsEventSource>() { CallBase = true };
1238+
var mockEventSource = new Mock<EventHubsEventSource>();
12391239
var mockProcessor = new Mock<MinimalProcessorMock>(4, "consumerGroup", "namespace", "eventHub", Mock.Of<TokenCredential>(), default(EventProcessorOptions)) { CallBase = true };
12401240

12411241
mockEventSource
@@ -1305,7 +1305,7 @@ public async Task StopProcessingLogsFaultedTaskDuringShutdown(bool async)
13051305
cancellationSource.CancelAfter(EventHubsTestEnvironment.Instance.TestExecutionTimeLimit);
13061306

13071307
var expectedException = new DivideByZeroException("BOOM!");
1308-
var mockEventSource = new Mock<EventHubsEventSource>() { CallBase = true };
1308+
var mockEventSource = new Mock<EventHubsEventSource>();
13091309
var mockProcessor = new Mock<MinimalProcessorMock>(4, "consumerGroup", "namespace", "eventHub", Mock.Of<TokenCredential>(), default(EventProcessorOptions)) { CallBase = true };
13101310

13111311
mockProcessor.Object.Logger = mockEventSource.Object;
@@ -1375,7 +1375,7 @@ public async Task StopProcessingIsSafeToCallInTheErrorHandler(bool async)
13751375
var startCompletionSource = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
13761376
var stopCompletionSource = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
13771377
var options = new EventProcessorOptions { LoadBalancingUpdateInterval = TimeSpan.FromMilliseconds(1) };
1378-
var mockEventSource = new Mock<EventHubsEventSource>() { CallBase = true };
1378+
var mockEventSource = new Mock<EventHubsEventSource>();
13791379
var mockConnection = new Mock<EventHubConnection>();
13801380
var mockProcessor = new Mock<MinimalProcessorMock>(65, "consumerGroup", "namespace", "eventHub", Mock.Of<TokenCredential>(), options) { CallBase = true };
13811381

0 commit comments

Comments
 (0)