# README
Azure Event Grid Namespaces Client Module for Go
Azure Event Grid is a highly scalable, fully managed Pub Sub message distribution service that offers flexible message consumption patterns. For more information about Event Grid see: link.
This client module allows you to publish events and receive events using the Pull delivery API.
NOTE: This client does not work with Event Grid Basic. Use the azeventgrid.Client in the
azeventgrid
package instead.
Key links:
Getting started
Install the package
Install the Azure Event Grid Namespaces client module for Go with go get
:
go get github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces
Prerequisites
- Go, version 1.18 or higher
- An Azure subscription
- An Event Grid namespace. You can create an Event Grid namespace using the Azure Portal.
- An Event Grid namespace topic. You can create an Event Grid namespace topic using the Azure Portal.
Authenticate the client
Event Grid Namespaces clients (SenderClient and ReceiverClient) authenticate using a TokenCredential, provided by the azidentity
module, or using a shared key credential.
Using a TokenCredential:
- SenderClient: NewSenderClient example.
- ReceiverClient: NewReceiverClient example.
Using a shared key:
- SenderClient: NewSenderClientWithSharedKeyCredential example.
- ReceiverClient: NewReceiverClientWithSharedKeyCredential example.
Key concepts
An Event Grid namespace is a container for multiple types of resources, including namespace topics:
- A namespace topic contains CloudEvents that you publish, via SenderClient.SendEvents.
- A topic subscription, associated with a single topic, can be used to receive events via ReceiverClient.ReceiveEvents.
Namespaces also offer access using MQTT, although that is not covered in this package.
Examples
Examples for various scenarios can be found on pkg.go.dev or in the example*_test.go files in our GitHub repo for aznamespaces.
Troubleshooting
Logging
This module uses the classification-based logging implementation in azcore
. To enable console logging for all SDK modules, set the environment variable AZURE_SDK_GO_LOGGING
to all
.
Use the azcore/log
package to control log event output.
import (
"fmt"
azlog "github.com/Azure/azure-sdk-for-go/sdk/azcore/log"
)
// print log output to stdout
azlog.SetListener(func(event azlog.Event, s string) {
fmt.Printf("[%s] %s\n", event, s)
})
Next steps
More sample code should go here, along with links out to the appropriate example tests.
Contributing
For details on contributing to this repository, see the contributing guide.
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 [email protected] with any additional questions or comments.
Additional Helpful Links for Contributors
Many people all over the world have helped make this project better. You'll want to check out:
- What are some good first issues for new contributors to the repo?
- How to build and test your change
- How you can make a change happen!
- Frequently Asked Questions (FAQ) and Conceptual Topics in the detailed Azure SDK for Go wiki.
Reporting security issues and security bugs
Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) [email protected]. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the Security TechCenter.
License
Azure SDK for Go is licensed under the MIT license.