Azure.Messaging.EventGrid.Namespaces
1.0.0-beta.1
Prefix Reserved
See the version list below for details.
dotnet add package Azure.Messaging.EventGrid.Namespaces --version 1.0.0-beta.1
NuGet\Install-Package Azure.Messaging.EventGrid.Namespaces -Version 1.0.0-beta.1
<PackageReference Include="Azure.Messaging.EventGrid.Namespaces" Version="1.0.0-beta.1" />
paket add Azure.Messaging.EventGrid.Namespaces --version 1.0.0-beta.1
#r "nuget: Azure.Messaging.EventGrid.Namespaces, 1.0.0-beta.1"
// Install Azure.Messaging.EventGrid.Namespaces as a Cake Addin #addin nuget:?package=Azure.Messaging.EventGrid.Namespaces&version=1.0.0-beta.1&prerelease // Install Azure.Messaging.EventGrid.Namespaces as a Cake Tool #tool nuget:?package=Azure.Messaging.EventGrid.Namespaces&version=1.0.0-beta.1&prerelease
Azure Event Grid client library for .NET
Azure Event Grid allows you to easily build applications with event-based architectures. The Event Grid service fully manages all routing of events from any source, to any destination, for any application. Azure service events and custom events can be published directly to the service, where the events can then be filtered and sent to various recipients, such as built-in handlers or custom webhooks. To learn more about Azure Event Grid: What is Event Grid?
Use the client library for Azure Event Grid to:
- Publish events to Event Grid topics using the Cloud Event schema
- Consume and settle events
[Source code][source_root] | [Package (NuGet)][package] | [API reference documentation][reference_docs] | [Product documentation][azconfig_docs] | [Samples][source_samples]
Source code | Package (NuGet) | API reference documentation | Product documentation
Getting started
Install the package
Install the client library for .NET with NuGet:
dotnet add package Azure.Messaging.EventGrid.Namespaces --prerelease
Prerequisites
You must have an Azure subscription and an Azure resource group with a custom Event Grid topic or domain. Follow this step-by-step tutorial to register the Event Grid resource provider and create Event Grid topics using the Azure portal. There is a similar tutorial using Azure CLI.
Authenticate the client
In order for the client library to interact with a topic or domain, you will need the endpoint
of the Event Grid topic and a credential
, which can be created using the topic's access key.
You can find the endpoint for your Event Grid topic either in the Azure Portal or by using the Azure CLI snippet below.
az eventgrid topic show --name <your-resource-name> --resource-group <your-resource-group-name> --query "endpoint"
The access key can also be found through the portal, or by using the Azure CLI snippet below:
az eventgrid topic key list --name <your-resource-name> --resource-group <your-resource-group-name> --query "key1"
Authenticate using Topic Access Key
Once you have your access key and topic endpoint, you can create the publisher client as follows:
// Construct the client using an Endpoint for a namespace as well as the shared access key
var client = new EventGridClient(new Uri(namespaceTopicHost), new AzureKeyCredential(namespaceKey));
Authenticate using an Entra ID
Azure Event Grid provides integration with Entra ID for identity-based authentication of requests. With Entra ID, you can use role-based access control (RBAC) to grant access to your Azure Event Grid resources to users, groups, or applications. The Azure Identity library provides easy Azure Active Directory support for authentication.
To send events to a topic or domain using Azure Active Directory, the authenticated identity should have the "EventGrid Data Sender" role assigned.
// Construct the client using an Endpoint for a namespace as well as the DefaultAzureCredential
var client = new EventGridClient(new Uri(namespaceTopicHost), new DefaultAzureCredential());
Key concepts
Thread safety
We guarantee that all client instance methods are thread-safe and independent of each other (guideline). This ensures that the recommendation of reusing client instances is always safe, even across threads.
Additional concepts
Client options | Accessing the response | Long-running operations | Handling failures | Diagnostics | Mocking | Client lifetime
Examples
You can familiarize yourself with different APIs using Samples.
Troubleshooting
Describe common errors and exceptions, how to "unpack" them if necessary, and include guidance for graceful handling and recovery.
Provide information to help developers avoid throttling or other service-enforced errors they might encounter. For example, provide guidance and examples for using retry or connection policies in the API.
If the package or a related package supports it, include tips for logging or enabling instrumentation to help them debug their code.
Next steps
View more https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/eventgrid/Azure.Messaging.EventGrid.Namespaces/samples here for common usages of the Event Grid client library: Event Grid Samples.
Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit Contributor License Agreements.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Azure.Core (>= 1.38.0)
- System.Text.Json (>= 4.7.2)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Azure.Messaging.EventGrid.Namespaces:
Package | Downloads |
---|---|
Workleap.DomainEventPropagation.Publishing
Propagate domain events with Azure |
|
Workleap.DomainEventPropagation.Subscription.PullDelivery
Propagate domain events with Azure |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 22,840 | 6/13/2024 |
1.0.0-beta.1 | 6,502 | 4/11/2024 |