Publisher confirms high level API
botanicus opened this issue · comments
Recently RabbitMQ introduced publisher confirms, which is basically a faster alternative to transactions.
Using publisher confirms requires a lot of client code though, we should come up with something more high level, so it'd be easier for people to use.
Irrelevant note: it's bug 24229 on RabbitMQ bugzilla (not publicly visible).
I've opened the same issue for Bunny.
To make it clear to folks who come from Google search: RabbitMQ publishers confirmations support in the Ruby amqp gem has been around for a while now but there are some ideas about what can be added on top of that.
You may want to look at https://gist.github.com/3042381. Its a higher level blocking publish API that makes use of publisher confirms and handles channel errors, returned messages, and nacks.
@eliaslevy looks good. I think we will have AMQP::ConfirmingPublisher
or something like that in 1.0. Thanks for sharing!
nacks? does publisher confirm really support that? doesn't look like it: https://gist.github.com/53e7da8c696b4be92617
on_ack is called as soon as the message is deliviered, not when acked/nacked by the consumer.
@carlhoerberg it is not supposed to be called when it is acked/nacked by the consumer. Publisher confirms work only between a publisher and the broker. As soon as the broker considers a message routed "safely", it sends an ack.
yeah, i found out, is there any way to detect nacks? with transactions? haven't found an example of transaction usage..