Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents 1.0.0 Prefix Reserved

Install-Package Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents -Version 1.0.0
dotnet add package Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents --version 1.0.0
<PackageReference Include="Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents as a Cake Addin
#addin nuget:?package=Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents&version=1.0.0

// Install Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents as a Cake Tool
#tool nuget:?package=Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

CloudNative CloudEvent support for Azure.Messaging.EventGrid library for .NET

This library can be used to enable publishing CloudNative CloudEvents using the Azure Event Grid library.

Getting started

Install the package

Install the client library from NuGet:

dotnet add package Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents --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"
Creating and Authenticating EventGridPublisherClient

Once you have your access key and topic endpoint, you can create the publisher client as follows:

EventGridPublisherClient client = new EventGridPublisherClient(
    new Uri("<endpoint>"),
    new AzureKeyCredential("<access-key>"));

Key concepts

For information about general Event Grid concepts: Concepts in Azure Event Grid.

For detailed information about the Event Grid client library concepts: Event Grid Client Library

Examples

EventGridPublisherClient client = new EventGridPublisherClient(
        new Uri(TestEnvironment.CloudEventTopicHost),
        new AzureKeyCredential(TestEnvironment.CloudEventTopicKey));

var cloudEvent =
    new CloudEvent
    {
        Type = "record",
        Source = new Uri("http://www.contoso.com"),
        Data = "data"
    };
await client.SendCloudNativeCloudEventAsync(cloudEvent);

Troubleshooting

For troubleshooting information, see the Event Grid Client Library documentation.

Next steps

View more samples here for common usages of the library.

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 https://cla.microsoft.com.

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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 553 9/7/2021
1.0.0-beta.2 716 6/15/2021
1.0.0-beta.1 615 3/18/2021