Skip to content

Commit

Permalink
Reset examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Mallets committed Dec 4, 2024
1 parent 7e66014 commit 94b06be
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions examples/examples/z_sub.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::time::Duration;

//
// Copyright (c) 2023 ZettaScale Technology
//
Expand Down Expand Up @@ -32,24 +30,23 @@ async fn main() {

println!("Press CTRL-C to quit...");
while let Ok(sample) = subscriber.recv_async().await {
tokio::time::sleep(Duration::from_millis(100)).await;
// // Refer to z_bytes.rs to see how to deserialize different types of message
// let payload = sample
// .payload()
// .try_to_string()
// .unwrap_or_else(|e| e.to_string().into());
// Refer to z_bytes.rs to see how to deserialize different types of message
let payload = sample
.payload()
.try_to_string()
.unwrap_or_else(|e| e.to_string().into());

// print!(
// ">> [Subscriber] Received {} ('{}': '{}')",
// sample.kind(),
// sample.key_expr().as_str(),
// payload
// );
// if let Some(att) = sample.attachment() {
// let att = att.try_to_string().unwrap_or_else(|e| e.to_string().into());
// print!(" ({})", att);
// }
// println!();
print!(
">> [Subscriber] Received {} ('{}': '{}')",
sample.kind(),
sample.key_expr().as_str(),
payload
);
if let Some(att) = sample.attachment() {
let att = att.try_to_string().unwrap_or_else(|e| e.to_string().into());
print!(" ({})", att);
}
println!();
}
}

Expand Down

0 comments on commit 94b06be

Please sign in to comment.