-
Notifications
You must be signed in to change notification settings - Fork 969
[azeventhubs] readme and more tests #18849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a4102c3
Changes to examples, adding in readme, prep for first beta release of…
richardpark-msft c6f2886
Update sdk/messaging/azeventhubs/README.md
richardpark-msft 4c0f2f2
Update sdk/messaging/azeventhubs/README.md
richardpark-msft 590f9cd
Update sdk/messaging/azeventhubs/README.md
richardpark-msft a5f4e41
Update sdk/messaging/azeventhubs/README.md
richardpark-msft a327c95
Rearrange mention of TokenCredential vs connection string.
richardpark-msft e85c997
Add impressions link
richardpark-msft 1fdb122
Updating changelog with release date.
richardpark-msft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| # Release History | ||
|
|
||
| ## 0.1.0 (TBD) | ||
| ## 0.1.0 (2022-08-11) | ||
|
|
||
| - Initial preview for the new version of the Azure Event Hubs Go SDK. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| # Azure Event Hubs Client Module for Go | ||
|
|
||
| [Azure Event Hubs](https://azure.microsoft.com/services/event-hubs/) is a big data streaming platform and event ingestion service from Microsoft. For more information about Event Hubs see: [link](https://docs.microsoft.com/azure/event-hubs/event-hubs-about). | ||
|
|
||
| Use the client library `github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs` in your application to: | ||
|
|
||
| - Send messages to an event hub. | ||
| - Consume messages from an event hub. | ||
|
|
||
| **NOTE**: This library is currently a beta. There may be breaking changes until it reaches semantic version `v1.0.0`. | ||
|
|
||
| Key links: | ||
| - [Source code][source] | ||
| - [API Reference Documentation][godoc] | ||
| - [Product documentation](https://azure.microsoft.com/services/event-hubs/) | ||
| - [Samples][godoc_examples] | ||
|
|
||
| ## Getting started | ||
|
|
||
| ### Install the package | ||
|
|
||
| Install the Azure Event Hubs client module for Go with `go get`: | ||
|
|
||
| ```bash | ||
| go get github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs | ||
| ``` | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Go, version 1.18 or higher | ||
| - An [Azure subscription](https://azure.microsoft.com/free/) | ||
| - An [Event Hub namespace](https://docs.microsoft.com/azure/event-hubs/). | ||
| - An Event Hub. You can create an event hub in your Event Hubs Namespace using the [Azure Portal](https://docs.microsoft.com/azure/event-hubs/event-hubs-create), or the [Azure CLI](https://docs.microsoft.com/azure/event-hubs/event-hubs-quickstart-cli). | ||
|
|
||
| ### Authenticate the client | ||
|
|
||
| Event Hub clients are created using an Event Hub a credential from the [Azure Identity package][azure_identity_pkg], like [DefaultAzureCredential][default_azure_credential]. | ||
| You can also create a client using a connection string. | ||
|
|
||
| #### Using a service principal | ||
| - ConsumerClient: [link](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs#example-NewConsumerClient) | ||
| - ProducerClient: [link](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs#example-NewProducerClient) | ||
|
|
||
| #### Using a connection string | ||
| - ConsumerClient: [link](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs#example-NewConsumerClientFromConnectionString) | ||
| - ProducerClient: [link](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs#example-NewProducerClientFromConnectionString) | ||
|
|
||
| # Key concepts | ||
|
|
||
| An Event Hub [**namespace**](https://docs.microsoft.com/azure/event-hubs/event-hubs-features#namespace) can have multiple event hubs. Each event hub, in turn, contains [**partitions**](https://docs.microsoft.com/azure/event-hubs/event-hubs-features#partitions) which store events. | ||
|
|
||
| Events are published to an event hub using an [event publisher](https://docs.microsoft.com/azure/event-hubs/event-hubs-features#event-publishers). In this package, the event publisher is the [ProducerClient](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs#ProducerClient) | ||
|
|
||
| Events can be consumed from an event hub using an [event consumer](https://docs.microsoft.com/azure/event-hubs/event-hubs-features#event-consumers). In this package, the event consumer is the [ConsumerClient](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs#ConsumerClient). | ||
|
|
||
| For more information about Event Hubs features and terminology can be found here: [link](https://docs.microsoft.com/azure/event-hubs/event-hubs-features) | ||
|
|
||
| # Examples | ||
|
|
||
| Examples for various scenarios can be found on [pkg.go.dev](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs#pkg-examples) or in the example*_test.go files in our GitHub repo for [azeventhubs](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/messaging/azeventhubs). | ||
|
|
||
| # 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 or to enable logs for `azservicebus` only. For example: | ||
|
|
||
| ```go | ||
| 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) | ||
| }) | ||
|
|
||
| // pick the set of events to log | ||
| azlog.SetEvents( | ||
| azeventhubs.EventConn, | ||
| azeventhubs.EventAuth, | ||
| azeventhubs.EventProducer, | ||
| azeventhubs.EventConsumer, | ||
| ) | ||
| ``` | ||
|
|
||
| ## Contributing | ||
| For details on contributing to this repository, see the [contributing guide][azure_sdk_for_go_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](https://opensource.microsoft.com/codeofconduct/). | ||
| For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or | ||
| contact [opencode@microsoft.com](mailto:opencode@microsoft.com) 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?](https://github.com/azure/azure-sdk-for-go/issues?q=is%3Aopen+is%3Aissue+label%3A%22up+for+grabs%22) | ||
| * [How to build and test your change][azure_sdk_for_go_contributing_developer_guide] | ||
| * [How you can make a change happen!][azure_sdk_for_go_contributing_pull_requests] | ||
| * Frequently Asked Questions (FAQ) and Conceptual Topics in the detailed [Azure SDK for Go wiki](https://github.com/azure/azure-sdk-for-go/wiki). | ||
|
|
||
| <!-- ### Community--> | ||
| ### Reporting security issues and security bugs | ||
|
|
||
| Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) <secure@microsoft.com>. 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](https://www.microsoft.com/msrc/faqs-report-an-issue). | ||
|
|
||
| ### License | ||
|
|
||
| Azure SDK for Go is licensed under the [MIT](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/messaging/azeventhubs/LICENSE.txt) license. | ||
|
|
||
| <!-- LINKS --> | ||
| [azure_sdk_for_go_contributing]: https://github.com/Azure/azure-sdk-for-go/blob/main/CONTRIBUTING.md | ||
| [azure_sdk_for_go_contributing_developer_guide]: https://github.com/Azure/azure-sdk-for-go/blob/main/CONTRIBUTING.md#developer-guide | ||
| [azure_sdk_for_go_contributing_pull_requests]: https://github.com/Azure/azure-sdk-for-go/blob/main/CONTRIBUTING.md#pull-requests | ||
|
|
||
| [azure_identity_pkg]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity | ||
| [default_azure_credential]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#NewDefaultAzureCredential | ||
| [source]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/messaging/azeventhubs | ||
| [godoc]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs | ||
| [godoc_examples]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs#pkg-examples | ||
|
|
||
|  | ||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.