Closed jage closed 8 years ago
We could just add an argument to Subscribe.new
(requeue_on_error: false
) or should the requeue be set based on the exception?
(how to requeue: http://www.rubydoc.info/github/ruby-amqp/bunny/Bunny/Channel#reject-instance_method)
Im thinking of creating a Message
class which subscription.subscribe gives to the block, instead of only the payload (which it is now).
subscription.subscribe do |message|
message # => Twingly::AMQP::Message
message.payload # => { url: "http://..." }
message.ack # default
message.reject
message.discard
end
This way it will be easier to expose the messages metadata
and delivery_info
(see the docs).
I like it.
Hmm... How to handle multiple "messages" in one payload: https://github.com/twingly/zambezi/commit/432bde61e1bd8f0014f6c76405fa01d46149f4ef ?
When we add an exception handler all messages are "acknowledged". We need to be able to re-queue messages for queue where we can't lose messages.