lapin icon indicating copy to clipboard operation
lapin copied to clipboard

How to correlate published messages with wait_for_confirms?

Open Roger opened this issue 2 years ago • 3 comments

I'm trying to use confirm_select and wait_for_confirms to get the list of acked/nacked messages, but every time I call wait_for_confirms it returns an empty Vec, even in the example is checking is_empty after publishing some messages.

With logs at trace level, I can see PublisherConfirm was ready but didn't carry a message, discarding that comes from https://github.com/amqp-rs/lapin/blob/main/src/returned_messages.rs#L149 so looks like the Ack doesn't carry any message.

Is there any way to know which published message was acked/nacked?

Roger avatar Jun 22 '22 18:06 Roger

You can either await the result of basic_publish to wait for this specific confirm, or call wait_for_confirms to wait for all pending confirmations. wait_for_confirms returns the list of messages that were nacked or rejected. If the list is empty, all messages have been acked

On Wed 22 Jun 2022 at 20:23, roger @.***> wrote:

I'm trying to use confirm_select and wait_for_confirms to get the list of acked/nacked messages, but every time I call wait_for_confirms it returns an empty Vec, even in the example is checking is_empty after publishing some messages https://github.com/amqp-rs/lapin/blob/main/examples/publisher_confirms.rs#L108 .

With logs at trace level, I can see PublisherConfirm was ready but didn't carry a message, discarding that comes from https://github.com/amqp-rs/lapin/blob/main/src/returned_messages.rs#L149 so looks like the Ack doesn't carry any message.

Is there any way to know which published message was acked/nacked?

— Reply to this email directly, view it on GitHub https://github.com/amqp-rs/lapin/issues/369, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABWNXRAWHYU2PPQIZS236TVQNK2PANCNFSM5ZRHAUHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Keruspe avatar Jun 22 '22 18:06 Keruspe

is wait_for_confirms more efficient than wait for each result of basic_publish? or internally is just waiting for each result?

Roger avatar Jun 23 '22 09:06 Roger

The internal mechanism is the same, but wait_for_confirms will only wait for the last publish

On Thu 23 Jun 2022 at 11:07, roger @.***> wrote:

is wait_for_confirms more efficient than wait for each result of basic_publish? or internally is just waiting for each result?

— Reply to this email directly, view it on GitHub https://github.com/amqp-rs/lapin/issues/369#issuecomment-1164151849, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABWNXSPR5BBLRZMRYWLWCLVQQSMXANCNFSM5ZRHAUHA . You are receiving this because you commented.Message ID: @.***>

Keruspe avatar Jun 23 '22 09:06 Keruspe