[rabbitmq-discuss] Using Pika Python client library with BlockingConnections and publisher-confirms - Does it work?
Matt Pietrek
mpietrek at skytap.com
Fri Feb 3 23:49:04 GMT 2012
Just trying to figure out if this should work so that I can stop beating my
head against the wall. And apologies for posting here, but I couldn¹t find
a forum dedicated to Pika to post to.
Our app is such that the asynchronous processing model doesn't work for us.
We want to reliably pull one message at a time off the queue, process it,
acknowledge it, and be done with it.
Towards this end, we're using a very simple setup using BlockingConnection,
basic_publish, basic_get and basic_ack. We're also using tx_select and
tx_confirm to guarantee messages are safely in the broker. However, given
what I've been reading, it seems like the RabbitMQ folks are strongly trying
to get folks off of transactions and on to publisher-confirms.
While I have strong concerns about message loss because of client crashes,
I'm nonetheless trying to experiment with publisher-confirms to see if they
work at all in our scenario.
And this is where I hit the wall. I can't get publisher-confirm callbacks to
work. The callback is never called. Is this expected to work?
Given a working example (without publisher-confirms), I've modified it as
follows:
self.channel = self.connection.channel()
self.channel.confirm_delivery(publisher_confirm,)
...
def write_message(self, queue_name, json_string):
self.channel.basic_publish(exchange='',
routing_key=queue_name,
body=json_string,
properties=pika.BasicProperties(delivery_mode=2))
def publisher_confirm(frame):
print "Got the message!"
My publisher_confirm() method is never called. And by putting breakpoints at
strategic points inside the Pika client library, I don't ever see any data
coming back from the server that would result in callbacks, despite my
writing 1000s messages/sec.
Thanks for any insight folks have,
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120203/aa32de7d/attachment.htm>
More information about the rabbitmq-discuss
mailing list