Does message confirmation work? (Rabbit backend)
See original GitHub issueI see there’s a commit referenced in #193 and some stuff in the docs.
I have set up an errback
function and am using ensure
, have also tried the extra transport options given here: http://stackoverflow.com/a/21016469/202168
publish
appears to send a message to my broker: I see a blip in the ‘Return’ graph of my test exchange (Rabbit web UI) but nothing goes through to the queue.
I guess I have something configured wrong, it sounds to me like a ‘Return’ means the message has bounced. My errback
does not get called though.
I also noticed that here in publish
method it says the mandatory
and immediate
args are “currently not supported”. I tried using them and immediate
gives a “AMQPNotImplementedError” but mandatory
does not.
At the moment I’m not sure a) if the kombu message confirm/retry/errback stuff works or b) how to debug my publishing problem.
I was also wondering about the on_return
arg for a Producer (“Callback to call for undeliverable messages”)… it sounds like what I need. It says “Note that the producer needs to drain events to use this feature”… I’m not clear exactly how this relates to the producer.
There’s a drain_events
method on the connection… I tried:
publish = conn.ensure(producer, producer.publish,
errback=_errback, max_retries=3)
publish(message, **kwargs)
print conn.drain_events(timeout=5)
The drain times-out though… am I doing it wrong? or no return/error means no events to drain, i.e. message succeeded?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top GitHub Comments
Btw, “confirms” usually refer to publisher confirmations, which is not related to the
mandatory
flag.To use publisher confirms you need to use pyamqp (not librabbitmq), and set the
confirm_publish
transport option:Connection(transport_options={'confirm_publish': True})
, or if using Celery:BROKER_TRANSPORT_OPTIONS = {'confirm_publish': True}
.They are shown, at least in RabbitMQ 3.6+; if you open a connection object you can see a “mode” setting of
C
for connections with confirms enabled.