-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Rust] Double Ack (Ack Ack) #241
base: main
Are you sure you want to change the base?
Conversation
Deploy preview for nats-by-example ready! ✅ Preview Built with commit 2ab081b. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put an explicit name for the consumer.
No description provided.