first commit

This commit is contained in:
2026-02-24 01:37:49 +01:00
commit 25e8c88ce0
15 changed files with 2620 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
[package]
name = "worker"
version = "0.1.0"
edition = "2024"
[dependencies]
async-nats = { version = "0.46.0" }
futures = { version = "0.3.32" }
futures-executor = { version = "0.3.32" }
tokio = { version = "1.49.0", features = ["macros", "rt-multi-thread"] }
+17
View File
@@ -0,0 +1,17 @@
use futures::StreamExt;
#[tokio::main]
async fn main() {
let nats_client = async_nats::connect("nats://localhost:4222")
.await
.expect("Error creating nats client");
let mut subscriber = nats_client
.queue_subscribe("jobs", "download".to_string())
.await
.unwrap();
// Receive and process messages
while let Some(message) = subscriber.next().await {
println!("Received message {:?}", message);
}
}