Crates.io | azure_storage_queues |
lib.rs | azure_storage_queues |
version | 0.20.0 |
source | src |
created_at | 2022-01-25 20:30:52.402388 |
updated_at | 2024-04-24 16:24:05.654373 |
description | Azure Queue Storage crate from the Azure SDK for Rust |
homepage | https://github.com/azure/azure-sdk-for-rust |
repository | https://github.com/azure/azure-sdk-for-rust |
max_upload_size | |
id | 521053 |
size | 127,090 |
This crate is from the Azure SDK for Rust. It supports Azure Queue Storage.
use azure_storage::prelude::*;
use azure_storage_queues::prelude::*;
#[tokio::main]
async fn main() -> azure_core::Result<()> {
let account = std::env::var("STORAGE_ACCOUNT").expect("missing STORAGE_ACCOUNT");
let access_key = std::env::var("STORAGE_ACCESS_KEY").expect("missing STORAGE_ACCESS_KEY");
let queue_name = std::env::var("STORAGE_QUEUE_NAME").expect("missing STORAGE_QUEUE_NAME");
let storage_credentials = StorageCredentials::access_key(account.clone(), access_key);
let queue_service = QueueServiceClient::new(account, storage_credentials);
let queue = queue_service.queue_client(queue_name);
// process messages until there are no more
loop {
let response = queue.get_messages().await?;
if response.messages.is_empty() {
break;
}
for message in response.messages {
println!("processing message {:?}", message);
queue.pop_receipt_client(message).delete().await?;
}
}
Ok(())
}
License: MIT