Conversation
|
Deploy preview for nats-by-example ready! ✅ Preview Built with commit 2ab081b. |
Jarema
left a comment
There was a problem hiding this comment.
Code-wise, this looks ok! It would be really good to explain in comment sections, like in other nats-by-examples, what are the differences between normal ack, and double ack so users know when to use which, and why.
| println!("Consumer 1"); | ||
| println!(" Start\n # pending messages: {}\n # messages with ack pending: {}", ci.num_pending, ci.num_ack_pending); | ||
|
|
||
| let message = consumer.fetch().max_messages(1).messages().await?.next().await.unwrap()?; |
There was a problem hiding this comment.
I would not unwrap the optional without comment here.
Let's explain to the user what is happening here: that messages() returns an iterator that is closed when None is returned.
maybe this is giving the user a better idea what is happening?
let fetch = consumer.fetch().max_messages(1).messages().await?;
let message = match fetch.next().await.expect("should get one message");| // Consumer 2 will use double_ack() | ||
| let stream = jetstream.get_stream("EVENTS".to_string()).await?; | ||
| let mut consumer = stream | ||
| .create_consumer(async_nats::jetstream::consumer::pull::Config { ..Default::default()}) |
There was a problem hiding this comment.
I would put an explicit name for the consumer.
No description provided.