-
Notifications
You must be signed in to change notification settings - Fork 299
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 |
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# 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>" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, this is the Azure CLi. The script below uses the Azure PowerShell cmdlets. This command makes no different. You can and should avoid the |
||
# 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" | ||
``` | ||
|
||
## 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 | ||
``` | ||
|
||
## Expected Test Behavior | ||
|
||
- **TokenCredential Tests**: Will skip if not properly configured (not a failure) | ||
- **Test Duration**: Each test typically takes 10-30 seconds due to network operations | ||
- **Resource Cleanup**: Tests automatically complete/delete sent messages | ||
|
||
## 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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# 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 | ||
|
||
[dependencies] | ||
async-lock.workspace = true | ||
async-stream.workspace = true | ||
async-trait.workspace = true | ||
azure_core.workspace = true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You want to disable default features here. See EH for an example. |
||
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 |
Uh oh!
There was an error while loading. Please reload this page.