This repository was archived by the owner on Mar 9, 2026. It is now read-only.
Add Azure Event Hubs component +#587
Merged
IEvangelist merged 4 commits intodotnet:preview-5from Apr 4, 2024
Merged
Conversation
tdykstra
approved these changes
Apr 4, 2024
Contributor
tdykstra
left a comment
There was a problem hiding this comment.
Looks good, I left a few minor suggestions.
|
|
||
| The following example assumes that you have an Azure Event Hubs namespace and an Event Hub created and wish to configure an `EventHubProducerClient` to send events to the Event Hub. The `EventHubConsumerClient`, `EventProcessorClient`, and `PartitionReceiver`are configured in a similar manner. | ||
|
|
||
| In the _Program.cs_ file of your component-consuming project, call the `AddAzureEventHubProducerClient` extension to register a `EventHubProducerClient` for use via the dependency injection container. |
Contributor
There was a problem hiding this comment.
Suggested change
| In the _Program.cs_ file of your component-consuming project, call the `AddAzureEventHubProducerClient` extension to register a `EventHubProducerClient` for use via the dependency injection container. | |
| In the _Program.cs_ file of your component-consuming project, call the `AddAzureEventHubProducerClient` extension to register an `EventHubProducerClient` for use via the dependency injection container. |
| The `AddAzureEventHubs` method will read connection information from the AppHost's configuration (for example, from "user secrets") under the `ConnectionStrings:eventHubsConnectionName` config key. The `WithReference` method passes that connection information into a connection string named `eventHubsConnectionName` in the `ExampleService` project. | ||
|
|
||
| > [!IMPORTANT] | ||
| > Even though we are creating an Event Hub using the `AddEventHub` at the same time as the namespace, as of .NET Aspire version `preview-5`, the connection string will not include the `EntityPath` property, so the `EventHubName` property must be set in the settings callback for the preferred client. Future versions of Aspire will include the `EntityPath` property in the connection string and will not require the `EventHubName` property to be set in this scenario. |
Contributor
There was a problem hiding this comment.
Suggested change
| > Even though we are creating an Event Hub using the `AddEventHub` at the same time as the namespace, as of .NET Aspire version `preview-5`, the connection string will not include the `EntityPath` property, so the `EventHubName` property must be set in the settings callback for the preferred client. Future versions of Aspire will include the `EntityPath` property in the connection string and will not require the `EventHubName` property to be set in this scenario. | |
| > Even though we are creating an Event Hub using the `AddEventHub` method at the same time as the namespace, as of .NET Aspire version `preview-5`, the connection string will not include the `EntityPath` property. So the `EventHubName` property must be set in the settings callback for the preferred client. Future versions of Aspire will include the `EntityPath` property in the connection string and will not require the `EventHubName` property to be set in this scenario. |
| > [!IMPORTANT] | ||
| > Even though we are creating an Event Hub using the `AddEventHub` at the same time as the namespace, as of .NET Aspire version `preview-5`, the connection string will not include the `EntityPath` property, so the `EventHubName` property must be set in the settings callback for the preferred client. Future versions of Aspire will include the `EntityPath` property in the connection string and will not require the `EventHubName` property to be set in this scenario. | ||
|
|
||
| In the _Program.cs_ file of `ExampleService`, the connection can be consumed using by calling of the supported Event Hubs client extension methods: |
Contributor
There was a problem hiding this comment.
Suggested change
| In the _Program.cs_ file of `ExampleService`, the connection can be consumed using by calling of the supported Event Hubs client extension methods: | |
| In the _Program.cs_ file of `ExampleService`, the connection can be consumed by calling the supported Event Hubs client extension methods: |
| }); | ||
| ``` | ||
|
|
||
| And then the connection information will be retrieved from the `ConnectionStrings` configuration section. Two connection formats are supported: |
Contributor
There was a problem hiding this comment.
Suggested change
| And then the connection information will be retrieved from the `ConnectionStrings` configuration section. Two connection formats are supported: | |
| And then the connection information is retrieved from the `ConnectionStrings` configuration section. Two connection formats are supported: |
|
|
||
| ### Use configuration providers | ||
|
|
||
| The .NET Aspire Azure Event Hubs library supports [Microsoft.Extensions.Configuration](https://learn.microsoft.com/dotnet/api/microsoft.extensions.configuration). It loads the `AzureMessagingEventHubsSettings` and the associated Options, e.g. `EventProcessorClientOptions`, from configuration by using the `Aspire:Azure:Messaging:EventHubs:` key prefix, followed by the name of the specific client in use. For example, consider the `appsettings.json` that configures some of the options for an `EventProcessorClient`: |
Contributor
There was a problem hiding this comment.
Suggested change
| The .NET Aspire Azure Event Hubs library supports [Microsoft.Extensions.Configuration](https://learn.microsoft.com/dotnet/api/microsoft.extensions.configuration). It loads the `AzureMessagingEventHubsSettings` and the associated Options, e.g. `EventProcessorClientOptions`, from configuration by using the `Aspire:Azure:Messaging:EventHubs:` key prefix, followed by the name of the specific client in use. For example, consider the `appsettings.json` that configures some of the options for an `EventProcessorClient`: | |
| The .NET Aspire Azure Event Hubs library supports [Microsoft.Extensions.Configuration](https://learn.microsoft.com/dotnet/api/microsoft.extensions.configuration). It loads the `AzureMessagingEventHubsSettings` and the associated Options, such as `EventProcessorClientOptions`, from configuration by using the `Aspire:Azure:Messaging:EventHubs:` key prefix, followed by the name of the specific client in use. For example, consider the `appsettings.json` that configures some of the options for an `EventProcessorClient`: |
| } | ||
| ``` | ||
|
|
||
| You can also setup the Options type using the optional `Action<IAzureClientBuilder<EventProcessorClient, EventProcessorClientOptions>> configureClientBuilder` parameter of the `AddAzureEventProcessorClient` method. For example, to set the processor's client ID for this client: |
Contributor
There was a problem hiding this comment.
Suggested change
| You can also setup the Options type using the optional `Action<IAzureClientBuilder<EventProcessorClient, EventProcessorClientOptions>> configureClientBuilder` parameter of the `AddAzureEventProcessorClient` method. For example, to set the processor's client ID for this client: | |
| You can also set up the Options type by using the optional `Action<IAzureClientBuilder<EventProcessorClient, EventProcessorClientOptions>> configureClientBuilder` parameter of the `AddAzureEventProcessorClient` method. For example, to set the processor's client ID for this client: |
IEvangelist
added a commit
that referenced
this pull request
Apr 9, 2024
* Add diagnostics overview page (#543) * Fix #521 * Try fixing xref * Add placeholder for preview-5 what's new (#558) * Add details about hosting components. (#559) * Add details about hosting components. Fixes #538 * Clean up description * Feedback * Fix warnings * Fix text, packages over components for hosting * Add new article to fix #551 (#562) * Add new article to fix #551 * fix tabs and correct text * Change from plaintext to output * Change alert * Update preview-5.md * Update preview-5.md * Add healthz details (#563) * Add healthz details * Touch date * Upgrade node-version * Sync with main * Fix MD lint issues * Added a section about custom service defaults (#560) * Update SD content, fixes #549 * Highlight dependency and add link/alert * Remove AddBuiltInMeters() (#518) Update the documentation to use built-in OpenTelemetry instrumentation. * Try sync with source (#570) * Update preview-5.md * Added a few bits about templates (#572) * Added a few bits about templates * Fix more MD lint issues * Initial bits for hosting changes. (#561) * Initial bits for hosting changes. Fixes #535 * Clean up list and text * Updated, let's go * Deployment scenarios with k8s (#583) * Try sync with source (#570) * Initial bits for hosting changes. (#561) * Initial bits for hosting changes. Fixes #535 * Clean up list and text * Updated, let's go * Add k8s content * Apply suggestions from code review Co-authored-by: Tom Dykstra <tdykstra@microsoft.com> * Apply suggestions from code review --------- Co-authored-by: Tom Dykstra <tdykstra@microsoft.com> * Add seq component (#584) * Add seq component * fixes * link fix * Apply suggestions from code review Co-authored-by: David Pine <david.pine@microsoft.com> --------- Co-authored-by: David Pine <david.pine@microsoft.com> * Nats component (#586) * Add NATS component * lint fixes * fixes * fix links * fix toc * Add Azure Event Hubs component + (#587) * Many fixes * touch dates. * Add to TOC * Remove from TOC * Update component section of preview5. * Correct package as Azure AI hosting * Add missing PostgreSQL hosting package * Clean up custom impl of service defaults * Initial content for preview 5. (#588) * Initial effort for local provisioning (#589) * Initial effort for local provisioning * TOC * Images and lightbow * Fix rendering issue * Tweak lightbox * Reposition article in TOC * Update docs/deployment/azure/local-provisioning.md Co-authored-by: David Fowler <davidfowl@gmail.com> * Remove zones * A bit of clean up for preview-5 * Move NATs * A few fixes * Fix image --------- Co-authored-by: David Fowler <davidfowl@gmail.com> * added tooling features * A few bits of cleanup * Added note about upgrade assistant tooling * More P5 updates across Azure, AppModel and manifest. (#596) * More P5 updates across Azure, AppModel and manifest. * Apply suggestions from code review * Apply suggestions from code review --------- Co-authored-by: David Pine <david.pine.7@gmail.com> * Another major edit pass, with several more to go * Add link * A few more bits of cleanup * Add link to templates * Fix xUnit template description * Another edit pass * Add link to upgrade with assitant * Remove .NET Core naming * For more info * Update docs/fundamentals/setup-tooling.md Co-authored-by: Aditya Mandaleeka <adityamandaleeka@users.noreply.github.com> * Fixed headings affecting TOC * Remove IDE protocol ending * Making dashboard auth be explicit on the config auth name * Dashboard section update * Dash * Update * Update * Update * Apply suggestions from code review * Update preview-5.md * Fix docker command * Add with external endpoint API * Fix non-nuget link warnings, and other CI issues * Fix last absolute link warning * Add ASPIRE_ALLOW_UNSECURED_TRANSPORT details * Minor tweaks * Typo * Apply suggestions from code review Co-authored-by: David Fowler <davidfowl@gmail.com> * Touch * Add AWS bits * Correct link --------- Co-authored-by: David Fowler <davidfowl@gmail.com> Co-authored-by: Martin Costello <martin@martincostello.com> Co-authored-by: kvenkatrajan <102772054+kvenkatrajan@users.noreply.github.com> Co-authored-by: Tom Dykstra <tdykstra@microsoft.com> Co-authored-by: alexwolfmsft <93200798+alexwolfmsft@users.noreply.github.com> Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com> Co-authored-by: Mitch Denny <midenn@microsoft.com> Co-authored-by: bradygaster <bradyg@microsoft.com> Co-authored-by: Tim Heuer <tim@timheuer.com> Co-authored-by: Aditya Mandaleeka <adityamandaleeka@users.noreply.github.com> Co-authored-by: James Newton-King <james@newtonking.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #554
Internal previews
Toggle expand/collapse