-
Notifications
You must be signed in to change notification settings - Fork 305
Initial Service Bus crate #2863
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
3 commits
Select commit
Hold shift + click to select a range
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,13 @@ | ||
amqps | ||
azuremessagingservicebus | ||
backoff | ||
mybus | ||
myqueue | ||
myservicebus | ||
retryable | ||
Retryable | ||
SubQueue | ||
subqueues | ||
testqueue | ||
testtopic | ||
testsubscription |
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,17 @@ | ||
# Release History | ||
|
||
## 0.1.0 (Unreleased) | ||
|
||
### Features Added | ||
|
||
- Initial release of Azure Service Bus client library for Rust | ||
- Support for sending and receiving messages from Service Bus queues and topics | ||
- Support for session-enabled entities | ||
- Support for dead letter queues | ||
- AMQP-based implementation using azure_core_amqp | ||
|
||
### Breaking Changes | ||
|
||
### Bugs Fixed | ||
|
||
### Other Changes |
114 changes: 114 additions & 0 deletions
114
sdk/servicebus/azure_messaging_servicebus/CONTRIBUTING.md
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,114 @@ | ||
# Running Azure Service Bus Live Tests | ||
|
||
This guide explains how to set up and run live integration tests for the Azure Service Bus SDK for Rust using the Azure SDK test infrastructure. | ||
|
||
## Prerequisites | ||
|
||
1. **Azure Subscription**: Access to the targeted subscription | ||
2. **Azure CLI**: Install and configure Azure CLI (`az login`) | ||
3. **Azure PowerShell**: Install PowerShell modules (`Install-Module Az -Force`) | ||
4. **Bicep**: For infrastructure deployment (`az bicep install`) | ||
5. **Permissions**: Contributor access to create resources in your subscription | ||
|
||
## Automated Test Infrastructure Setup | ||
|
||
The Azure SDK provides a standardized test infrastructure using the `New-TestResources.ps1` script with Bicep templates to automatically create and configure all required Azure Service Bus resources. | ||
|
||
### Deploy Test Resources | ||
|
||
From the repository root, run: | ||
|
||
```powershell | ||
# Set subscription | ||
az account set --subscription "<Your Subscription Name>" | ||
RickWinter marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Deploy test infrastructure | ||
./eng/common/TestResources/New-TestResources.ps1 servicebus/azure_messaging_servicebus -SubscriptionId <subscription ID> | ||
``` | ||
|
||
This will automatically create: | ||
|
||
- Azure Service Bus namespace with Standard tier | ||
- Test queue named `testqueue` | ||
- Test topic named `testtopic` with subscription `testsubscription` | ||
- RBAC permissions for TokenCredential testing | ||
- All required environment variables | ||
|
||
The script will output PowerShell commands to set environment variables. | ||
|
||
### Environment Variables | ||
|
||
After deployment completes successfully, the script will output commands like: | ||
|
||
```powershell | ||
$env:SERVICEBUS_NAMESPACE = "sb-your-deployment-name.servicebus.windows.net" | ||
$env:SERVICEBUS_QUEUE_NAME = "testqueue" | ||
$env:SERVICEBUS_TOPIC_NAME = "testtopic" | ||
$env:SERVICEBUS_SUBSCRIPTION_NAME = "testsubscription" | ||
``` | ||
RickWinter marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Run Live Tests | ||
|
||
Once the environment variables are set, run the tests: | ||
|
||
**All Live Tests:** | ||
|
||
```powershell | ||
cd sdk/servicebus/azure_messaging_servicebus | ||
cargo test | ||
``` | ||
|
||
## Debugging | ||
|
||
Enable debug logging for detailed information: | ||
|
||
```powershell | ||
$env:RUST_LOG = "debug" | ||
cargo test | ||
``` | ||
|
||
For detailed AMQP protocol debugging: | ||
|
||
```powershell | ||
$env:RUST_LOG = "azure_messaging_servicebus=debug,azure_core_amqp=debug" | ||
cargo test | ||
``` | ||
|
||
## Troubleshooting | ||
|
||
### Deployment Issues | ||
|
||
- Ensure you're logged into Azure CLI: `az login` | ||
- Verify you have Contributor permissions on the subscription | ||
- Check that the resource group name doesn't already exist | ||
- Ensure Service Bus is available in your selected region | ||
|
||
### Authentication Issues | ||
|
||
- For TokenCredential tests, ensure you're logged in via Azure CLI | ||
- RBAC permissions are automatically configured during deployment | ||
- Service principal credentials can be set via environment variables if needed | ||
|
||
### Test Execution Issues | ||
|
||
- Verify all environment variables are set correctly | ||
- Check that Service Bus resources are in "Active" status | ||
- Ensure network connectivity to Azure Service Bus | ||
- Review test output for specific error messages | ||
|
||
## Resource Cleanup | ||
|
||
When you're finished testing, clean up the resources: | ||
|
||
```powershell | ||
# Clean up test resources | ||
./eng/common/TestResources/Remove-TestResources.ps1 servicebus/azure_messaging_servicebus | ||
``` | ||
|
||
## Performance Notes | ||
|
||
- Live tests create real network connections | ||
- Messages are sent to actual Azure Service Bus queues | ||
- Consider using a dedicated test namespace | ||
- Tests include cleanup operations (complete/delete messages) | ||
- Some tests may have delays for timing validation |
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,44 @@ | ||
# Copyright (c) Microsoft Corp. All Rights Reserved. | ||
# Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
[package] | ||
name = "azure_messaging_servicebus" | ||
version = "0.1.0" | ||
description = "Rust client for Azure Service Bus" | ||
readme = "README.md" | ||
authors.workspace = true | ||
license.workspace = true | ||
repository.workspace = true | ||
homepage = "https://github.com/azure/azure-sdk-for-rust" | ||
documentation = "https://docs.rs/azure_messaging_servicebus" | ||
keywords = ["sdk", "azure", "messaging", "cloud", "servicebus"] | ||
categories = ["api-bindings"] | ||
edition.workspace = true | ||
publish = false | ||
|
||
[dependencies] | ||
async-lock.workspace = true | ||
async-stream.workspace = true | ||
async-trait.workspace = true | ||
azure_core = { path = "../../core/azure_core", version = "0.28.0", default-features = false } | ||
azure_core_amqp.workspace = true | ||
futures.workspace = true | ||
rand.workspace = true | ||
rand_chacha.workspace = true | ||
serde = { workspace = true, features = ["derive"] } | ||
time.workspace = true | ||
tracing.workspace = true | ||
url.workspace = true | ||
uuid.workspace = true | ||
|
||
[dev-dependencies] | ||
azure_core_amqp = { workspace = true, features = ["test"] } | ||
azure_core_test = { workspace = true, features = ["tracing"] } | ||
azure_identity.workspace = true | ||
azure_messaging_servicebus = { path = "." } | ||
serde_json.workspace = true | ||
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } | ||
tracing-subscriber = { workspace = true, features = ["env-filter", "fmt"] } | ||
RickWinter marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
[lints] | ||
workspace = true |
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.