#[path = "common/mod.rs"]
mod common;
use armada_client::ArmadaClient;
use futures::StreamExt;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
tracing_subscriber::fmt::init();
let endpoint =
std::env::var("ARMADA_ENDPOINT").unwrap_or_else(|_| "http://localhost:50051".to_string());
let queue = std::env::var("ARMADA_QUEUE").unwrap_or_else(|_| "test".to_string());
let job_set_id =
std::env::var("ARMADA_JOB_SET").unwrap_or_else(|_| "rust-smoke-test".to_string());
let client = ArmadaClient::connect(endpoint, common::auth_from_env()).await?;
println!("Watching job set '{job_set_id}' on queue '{queue}'...");
let mut last_id = String::new();
let mut stream = client.watch(&queue, &job_set_id, None).await?;
while let Some(event) = stream.next().await {
match event {
Ok(msg) => {
last_id = msg.id.clone();
println!(" event id={} message={:?}", msg.id, msg.message);
}
Err(e) => {
eprintln!(" stream error: {e}");
break;
}
}
}
let _ = last_id;
Ok(())
}