Skip to content

Commit c885a16

Browse files
authored
Merge pull request #102758 from spelluru/ehubdotnet0129
.NET SDK release
2 parents d1bf45c + ceafbb3 commit c885a16

20 files changed

+638
-223
lines changed

.openpublishing.redirection.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13291,6 +13291,11 @@
1329113291
"redirect_url": "/azure/event-hubs/event-hubs-quickstart-powershell",
1329213292
"redirect_document_id": false
1329313293
},
13294+
{
13295+
"source_path": "articles/event-hubs/event-hubs-managed-service-identity.md",
13296+
"redirect_url": "/azure/event-hubs/authenticate-managed-identity",
13297+
"redirect_document_id": false
13298+
},
1329413299
{
1329513300
"source_path": "articles/event-hubs/event-hubs-node-get-started-receive.md",
1329613301
"redirect_url": "/azure/event-hubs/event-hubs-node-get-started-send",

articles/active-directory/managed-identities-azure-resources/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
- name: Azure App Service and Functions
5252
href: /azure/app-service/overview-managed-identity?context=azure/active-directory/managed-identities-azure-resources/context/msi-context
5353
- name: Azure Event Hubs
54-
href: /azure/event-hubs/event-hubs-managed-service-identity?context=azure/active-directory/managed-identities-azure-resources/context/msi-context
54+
href: /azure/event-hubs/authenticate-managed-identity.md?context=azure/active-directory/managed-identities-azure-resources/context/msi-context
5555
- name: Azure Container Instances
5656
href: /azure/container-instances/container-instances-managed-identity?context=azure/active-directory/managed-identities-azure-resources/context/msi-context
5757
- name: How-to guides

articles/active-directory/managed-identities-azure-resources/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Learn how to use a managed identity with other Azure services:
132132
* [Azure API Management](../../api-management/api-management-howto-use-managed-service-identity.md)
133133
* [Azure Container Instances](../../container-instances/container-instances-managed-identity.md)
134134
* [Azure Container Registry Tasks](../../container-registry/container-registry-tasks-authentication-managed-identity.md)
135-
* [Azure Event Hubs](../../event-hubs/event-hubs-managed-service-identity.md)
135+
* [Azure Event Hubs](../../event-hubs/authenticate-managed-identity.md)
136136
* [Azure Functions](/azure/app-service/overview-managed-identity)
137137
* [Azure Kubernetes Service](/azure/aks/use-managed-identity)
138138
* [Azure Logic Apps](/azure/logic-apps/create-managed-service-identity)

articles/azure-monitor/platform/diagnostics-extension-stream-event-hubs.md

Lines changed: 67 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ In this example, the sink is applied to logs and is filtered only to error level
197197
## Deploy and update a Cloud Services application and diagnostics config
198198
Visual Studio provides the easiest path to deploy the application and Event Hubs sink configuration. To view and edit the file, open the *.wadcfgx* file in Visual Studio, edit it, and save it. The path is **Cloud Service Project** > **Roles** > **(RoleName)** > **diagnostics.wadcfgx**.
199199

200-
At this point, all deployment and deployment update actions in Visual Studio, Visual Studio Team System, and all commands or scripts that are based on MSBuild and use the **/t:publish** target include the *.wadcfgx* in the packaging process. In addition, deployments and updates deploy the file to Azure by using the appropriate Azure Diagnostics agent extension on your VMs.
200+
At this point, all deployment and deployment update actions in Visual Studio, Visual Studio Team System, and all commands or scripts that are based on MSBuild and use the `/t:publish` target include the *.wadcfgx* in the packaging process. In addition, deployments and updates deploy the file to Azure by using the appropriate Azure Diagnostics agent extension on your VMs.
201201

202202
After you deploy the application and Azure Diagnostics configuration, you will immediately see activity in the dashboard of the event hub. This indicates that you're ready to move on to viewing the hot-path data in the listener client or analysis tool of your choice.
203203

@@ -211,14 +211,72 @@ In the following figure, the Event Hubs dashboard shows healthy sending of diagn
211211
>
212212
213213
## View hot-path data
214-
As discussed previously, there are many use cases for listening to and processing Event Hubs data.
214+
As discussed previously, there are many use cases for listening to and processing Event Hubs data. One simple approach is to create a small test console application to listen to the event hub and print the output stream.
215215

216-
One simple approach is to create a small test console application to listen to the event hub and print the output stream. You can place the following code, which is explained in more detail
217-
in [Get started with Event Hubs](../../event-hubs/event-hubs-dotnet-standard-getstarted-send.md)), in a console application.
216+
#### [.NET SDK latest (5.0.0 or later)](#tab/latest)
217+
You can place the following code, which is explained in more detail in [Get started with Event Hubs](../../event-hubs/get-started-dotnet-standard-send-v2.md)), in a console application.
218218

219-
Note that the console application must include the [Event Processor Host NuGet package](https://www.nuget.org/packages/Microsoft.Azure.ServiceBus.EventProcessorHost/).
219+
```csharp
220+
using System;
221+
using System.Text;
222+
using System.Threading.Tasks;
223+
using Azure.Storage.Blobs;
224+
using Azure.Messaging.EventHubs;
225+
using Azure.Messaging.EventHubs.Processor;
226+
namespace Receiver1204
227+
{
228+
class Program
229+
{
230+
private static readonly string ehubNamespaceConnectionString = "EVENT HUBS NAMESPACE CONNECTION STRING";
231+
private static readonly string eventHubName = "EVENT HUB NAME";
232+
private static readonly string blobStorageConnectionString = "AZURE STORAGE CONNECTION STRING";
233+
private static readonly string blobContainerName = "BLOB CONTAINER NAME";
220234

221-
Remember to replace the values in angle brackets in the **Main** function with values for your resources.
235+
static async Task Main()
236+
{
237+
// Read from the default consumer group: $Default
238+
string consumerGroup = EventHubConsumerClient.DefaultConsumerGroupName;
239+
240+
// Create a blob container client that the event processor will use
241+
BlobContainerClient storageClient = new BlobContainerClient(blobStorageConnectionString, blobContainerName);
242+
243+
// Create an event processor client to process events in the event hub
244+
EventProcessorClientOptions options = new EventProcessorClientOptions { }
245+
EventProcessorClient processor = new EventProcessorClient(storageClient, consumerGroup, ehubNamespaceConnectionString, eventHubName);
246+
247+
// Register handlers for processing events and handling errors
248+
processor.ProcessEventAsync += ProcessEventHandler;
249+
processor.ProcessErrorAsync += ProcessErrorHandler;
250+
251+
// Start the processing
252+
await processor.StartProcessingAsync();
253+
254+
// Wait for 10 seconds for the events to be processed
255+
await Task.Delay(TimeSpan.FromSeconds(10));
256+
257+
// Stop the processing
258+
await processor.StopProcessingAsync();
259+
}
260+
261+
static Task ProcessEventHandler(ProcessEventArgs eventArgs)
262+
{
263+
Console.WriteLine("\tRecevied event: {0}", Encoding.UTF8.GetString(eventArgs.Data.Body.ToArray()));
264+
return Task.CompletedTask;
265+
}
266+
267+
static Task ProcessErrorHandler(ProcessErrorEventArgs eventArgs)
268+
{
269+
Console.WriteLine($"\tPartition '{ eventArgs.PartitionId}': an unhandled exception was encountered. This was not expected to happen.");
270+
Console.WriteLine(eventArgs.Exception.Message);
271+
return Task.CompletedTask;
272+
}
273+
}
274+
}
275+
```
276+
277+
#### [.NET SDK legacy (4.1.0 or earlier)](#tab/legacy)
278+
279+
You can place the following code, which is explained in more detail in [Get started with Event Hubs](../../event-hubs/event-hubs-dotnet-standard-getstarted-send.md)), in a console application. Note that the console application must include the [Event Processor Host Nuget package](https://www.nuget.org/packages/Microsoft.Azure.ServiceBus.EventProcessorHost/). Remember to replace the values in angle brackets in the **Main** function with values for your resources.
222280

223281
```csharp
224282
//Console application code for EventHub test client
@@ -300,14 +358,15 @@ namespace EventHubListener
300358
}
301359
}
302360
```
361+
---
303362

304363
## Troubleshoot Event Hubs sinks
305364
* The event hub does not show incoming or outgoing event activity as expected.
306365

307366
Check that your event hub is successfully provisioned. All connection info in the **PrivateConfig** section of *.wadcfgx* must match the values of your resource as seen in the portal. Make sure that you have a SAS policy defined ("SendRule" in the example) in the portal and that *Send* permission is granted.
308367
* After an update, the event hub no longer shows incoming or outgoing event activity.
309368

310-
First, make sure that the event hub and configuration info is correct as explained previously. Sometimes the **PrivateConfig** is reset in a deployment update. The recommended fix is to make all changes to *.wadcfgx* in the project and then push a complete application update. If this is not possible, make sure that the diagnostics update pushes a complete **PrivateConfig** that includes the SAS key.
369+
First, make sure that the event hub and configuration info are correct as explained previously. Sometimes the **PrivateConfig** is reset in a deployment update. The recommended fix is to make all changes to *.wadcfgx* in the project and then push a complete application update. If this is not possible, make sure that the diagnostics update pushes a complete **PrivateConfig** that includes the SAS key.
311370
* I tried the suggestions, and the event hub is still not working.
312371

313372
Try looking in the Azure Storage table that contains logs and errors for Azure Diagnostics itself: **WADDiagnosticInfrastructureLogsTable**. One option is to use a tool such as [Azure Storage Explorer](https://www.storageexplorer.com) to connect to this storage account, view this table, and add a query for TimeStamp in the last 24 hours. You can use the tool to export a .csv file and open it in an application such as Microsoft Excel. Excel makes it easy to search for calling-card strings, such as **EventHubs**, to see what error is reported.
@@ -383,7 +442,7 @@ The complementary *ServiceConfiguration.Cloud.cscfg* for this example looks like
383442
</ServiceConfiguration>
384443
```
385444

386-
Equivalent JSON settings for virtual machines is as follows:
445+
Equivalent JSON settings for virtual machines are as follows:
387446

388447
Public Settings:
389448
```JSON

articles/event-hubs/TOC.yml

Lines changed: 62 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,27 @@
2626
href: event-hubs-resource-manager-namespace-event-hub.md
2727
- name: Send and receive events
2828
items:
29-
- name: .NET Core
30-
href: event-hubs-dotnet-standard-getstarted-send.md
31-
- name: Java
29+
- name: .NET Core (Azure.Messaging.EventHubs)
30+
href: get-started-dotnet-standard-send-v2.md
31+
- name: Java (azure-eventhubs)
3232
href: event-hubs-java-get-started-send.md
33-
- name: Python
33+
- name: Python (azure-eventhub version 5)
3434
href: get-started-python-send-v2.md
35-
- name: Node.js
35+
- name: Node.js (azure/event-hubs version 5)
3636
href: get-started-node-send-v2.md
3737
- name: Go
3838
href: event-hubs-go-get-started-send.md
3939
- name: C (send only)
4040
href: event-hubs-c-getstarted-send.md
4141
- name: Apache Storm (receive only)
4242
href: event-hubs-storm-getstarted-receive.md
43-
- name: .NET Framework
44-
href: event-hubs-dotnet-framework-getstarted-send.md
4543
- name: Capture events
4644
items:
4745
- name: Use the Azure portal to enable Event Hubs Capture
4846
href: event-hubs-capture-enable-through-portal.md
4947
- name: Use a Resource Manager template to enable Event Hubs Capture
5048
href: event-hubs-resource-manager-namespace-event-hub-enable-capture.md
51-
- name: Capture Event Hubs data using Python
49+
- name: Capture Event Hubs data using Python (azure-eventhub version 5)
5250
href: get-started-capture-python-v2.md
5351
- name: Stream into Event Hubs for Apache Kafka
5452
href: event-hubs-quickstart-kafka-enabled-event-hubs.md
@@ -71,8 +69,10 @@
7169
items:
7270
- name: Event Hubs terminology
7371
href: event-hubs-features.md
74-
- name: Event processor host
72+
- name: Event processor host (legacy SDK)
7573
href: event-hubs-event-processor-host.md
74+
- name: Event processor (latest SDK)
75+
href: event-processor-balance-partition-load.md
7676
- name: Availability and consistency
7777
href: event-hubs-availability-and-consistency.md
7878
- name: Scalability
@@ -116,20 +116,26 @@
116116
href: event-hubs-exchange-events-different-protocols.md
117117
- name: Programming guides
118118
items:
119-
- name: Python
119+
- name: .NET (Azure.Messaging.EventHubs)
120+
href: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/eventhub/Azure.Messaging.EventHubs/README.md
121+
- name: Python (azure-eventhub version 5)
120122
href: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventhub/azure-eventhub/README.md
121-
- name: JavaScript
123+
- name: JavaScript (azure/event-hubs version 5)
122124
href: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/azure-messaging-eventhubs/README.md
123-
- name: .NET programming guide
125+
- name: .NET (Microsoft.Azure.EventHubs)
124126
href: event-hubs-programming-guide.md
125-
- name: Read captured data using Python (legacy)
127+
- name: Read captured data using Python (azure-eventhub version 1)
126128
href: event-hubs-capture-python.md
127-
- name: Send and receive events (legacy)
129+
- name: Send and receive events (old versions/packages)
128130
items:
129-
- name: Python (legacy)
131+
- name: .NET Core (Microsoft.Azure.EventHubs)
132+
href: event-hubs-dotnet-standard-getstarted-send.md
133+
- name: Python (azure-eventhub version 1)
130134
href: event-hubs-python-get-started-send.md
131-
- name: Node.js (legacy)
135+
- name: Node.js (azure/event-hubs version 2)
132136
href: event-hubs-node-get-started-send.md
137+
- name: .NET Framework (Microsoft.Azure.EventHubs)
138+
href: event-hubs-dotnet-framework-getstarted-send.md
133139
- name: Process data
134140
items:
135141
- name: Process data using Azure Stream Analytics
@@ -186,34 +192,52 @@
186192
href: resource-manager-exceptions.md
187193
- name: Reference
188194
items:
189-
- name: Java
190-
items:
191-
- name: com.microsoft.azure.eventhubs
192-
href: /java/api/com.microsoft.azure.eventhubs
193-
- name: com.microsoft.azure.eventprocessorhost
194-
href: /java/api/com.microsoft.azure.eventprocessorhost
195195
- name: .NET
196196
items:
197-
- name: Microsoft.Azure.EventHubs
198-
href: /dotnet/api/microsoft.azure.eventhubs
199-
- name: Microsoft.Azure.EventHubs.Processor
200-
href: /dotnet/api/microsoft.azure.eventhubs.processor
201-
- name: Microsoft.ServiceBus.Messaging
202-
href: /dotnet/api/microsoft.servicebus.messaging
203-
- name: Microsoft.ServiceBus.Messaging.EventProcessorHost
204-
href: /dotnet/api/microsoft.servicebus.messaging.eventprocessorhost
205-
- name: Microsoft.Azure.Management.EventHub
197+
- name: Client library
198+
items:
199+
- name: Migrate from Microsoft.Azure.Event Hubs to Azure.Messaging.EventHubs
200+
href: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/eventhub/Azure.Messaging.EventHubs/MIGRATIONGUIDE.md
201+
- name: Azure.Messaging.EventHubs (latest)
202+
href: /dotnet/api/azure.messaging.eventhubs?view=azure-dotnet-preview
203+
- name: Microsoft.Azure.EventHubs (legacy)
204+
href: /dotnet/api/microsoft.azure.eventhubs
205+
- name: Microsoft.ServiceBus.Messaging (legacy)
206+
href: /dotnet/api/microsoft.servicebus.messaging
207+
- name: Management library
206208
href: /dotnet/api/microsoft.azure.management.eventhub
207-
- name: Node.js
208-
items:
209-
- name: Migrate from version 2 to version 5
210-
href: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/eventhub/event-hubs/migrationguide.md
211-
- name: API reference
212-
href: /javascript/api/overview/azure/event-hub?view=azure-node-latest
209+
- name: Java
210+
items:
211+
- name: Client library
212+
items:
213+
- name: azure-eventhubs
214+
href: /java/api/overview/azure/eventhubs/client?view=azure-java-stable
215+
- name: Management library
216+
href: /java/api/com.microsoft.azure.management.eventhub?view=azure-java-stable
213217
- name: Python
214218
items:
215-
- name: Migrate from version 1 to version 5
219+
- name: Migrate from azure-eventhub version 1 to version 5
216220
href: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventhub/azure-eventhub/migration_guide.md
221+
- name: Client library
222+
items:
223+
- name: azure-eventhub version 5
224+
href: /python/api/azure-eventhub/?view=azure-python-preview
225+
- name: azure-eventhub version 1
226+
href: /python/api/azure-eventhub/?view=azure-python
227+
- name: Management library
228+
href: /python/api/overview/azure/event-hub?view=azure-python
229+
- name: Node.js
230+
items:
231+
- name: Migrate from azure/eventhubs version 2 to version 5
232+
href: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/eventhub/event-hubs/migrationguide.md
233+
- name: Client library
234+
items:
235+
- name: azure/eventhubs version 5
236+
href: /javascript/api/@azure/event-hubs/?view=azure-node-preview
237+
- name: azure/eventhubs version 2
238+
href: /javascript/api/@azure/event-hubs/?view=azure-node-latest
239+
- name: Management library
240+
href: /javascript/api/@azure/arm-eventhub/?view=azure-node-latest
217241
- name: REST
218242
href: /rest/api/eventhub
219243
- name: Resource Manager template

0 commit comments

Comments
 (0)