Skip to content

Commit f1e6963

Browse files
committed
add information to the example
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
1 parent d62543e commit f1e6963

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

examples/receive_super_stream.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
2828
}
2929
}
3030
}
31-
println!("Super stream consumer example, consuming messages from the super stream {}", super_stream);
31+
println!(
32+
"Super stream consumer example, consuming messages from the super stream {}",
33+
super_stream
34+
);
3235
let mut super_stream_consumer: SuperStreamConsumer = environment
3336
.super_stream_consumer()
3437
.offset(OffsetSpecification::First)
@@ -42,9 +45,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
4245
let delivery = delivery.unwrap();
4346
println!(
4447
"Got message: {:#?} from stream: {} with offset: {}",
45-
delivery.message()
48+
delivery
49+
.message()
4650
.data()
47-
.map(|data| String::from_utf8(data.to_vec()).unwrap()).unwrap(),
51+
.map(|data| String::from_utf8(data.to_vec()).unwrap())
52+
.unwrap(),
4853
delivery.stream(),
4954
delivery.offset()
5055
);

examples/send_super_stream.rs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rabbitmq_stream_client::error::{StreamCreateError};
1+
use rabbitmq_stream_client::error::StreamCreateError;
22
use rabbitmq_stream_client::types::{
33
ByteCapacity, HashRoutingMurmurStrategy, Message, ResponseCode, RoutingStrategy,
44
};
@@ -35,8 +35,15 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
3535
let delete_stream = environment.delete_super_stream(super_stream).await;
3636

3737
match delete_stream {
38-
Ok(_) => { println!("Successfully deleted super stream {}", super_stream); }
39-
Err(err) => { println!("Failed to delete super stream {}. error {}", super_stream, err); }
38+
Ok(_) => {
39+
println!("Successfully deleted super stream {}", super_stream);
40+
}
41+
Err(err) => {
42+
println!(
43+
"Failed to delete super stream {}. error {}",
44+
super_stream, err
45+
);
46+
}
4047
}
4148

4249
let create_response = environment
@@ -56,7 +63,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
5663
}
5764
}
5865
}
59-
println!("Super stream example. Sending {} messages to the super stream: {}", message_count, super_stream);
66+
println!(
67+
"Super stream example. Sending {} messages to the super stream: {}",
68+
message_count, super_stream
69+
);
6070
let mut super_stream_producer = environment
6171
.super_stream_producer(RoutingStrategy::HashRoutingStrategy(
6272
HashRoutingMurmurStrategy {
@@ -91,7 +101,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
91101
}
92102

93103
notify_on_send.notified().await;
94-
println!("Successfully sent {} messages to the super stream {}", message_count, super_stream);
104+
println!(
105+
"Successfully sent {} messages to the super stream {}",
106+
message_count, super_stream
107+
);
95108
let _ = super_stream_producer.close().await;
96109
Ok(())
97110
}

0 commit comments

Comments
 (0)