mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-04 05:31:32 +00:00
krata: restructure packages for cleanliness
This commit is contained in:
23
crates/runtime/examples/channel.rs
Normal file
23
crates/runtime/examples/channel.rs
Normal file
@ -0,0 +1,23 @@
|
||||
use anyhow::Result;
|
||||
use env_logger::Env;
|
||||
use kratart::channel::ChannelService;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
env_logger::Builder::from_env(Env::default().default_filter_or("info")).init();
|
||||
|
||||
let (service, mut receiver) = ChannelService::new("krata-channel".to_string()).await?;
|
||||
let task = service.launch().await?;
|
||||
|
||||
loop {
|
||||
let Some((id, data)) = receiver.recv().await else {
|
||||
break;
|
||||
};
|
||||
|
||||
println!("domain {} = {:?}", id, data);
|
||||
}
|
||||
|
||||
task.abort();
|
||||
|
||||
Ok(())
|
||||
}
|
Reference in New Issue
Block a user