On Thu, Mar 29, 2012 at 19:13, Matt Pietrek wrote:
Thanks Marek,

Every day's a school day. I didn't know about the mandatory flag.

HOWEVER... Having added to the code below, I still don't get and indication
of error. Stepping into the tx_commit code, I see what looks like a
Tx.CommitOK message back from the server. I've double-verified that the
queue I'm sending to doesn't exist.
Yes, messages sent with `mandatory` ?flag don't result in an error.

Instead the message is returned by the broker to your client.
This is done using Basic.Return AMQP method, you should be able
to catch this from pika.

My guess is that `channel.add_on_return_callback` allows
you to pass a callback for this case.
? ?http://pika.github.com/channel.html#id1

Marek
On Thu, Mar 29, 2012 at 3:52 AM, Marek Majkowski wrote:
On Thu, Mar 29, 2012 at 01:16, Matt Pietrek wrote:
I have a Pika code sequence that looks like this:

? ? ? ? ? ? ? ? ? ? channel = self._channel
? ? ? ? ? ? ? ? ? ? channel.tx_select()
? ? ? ? ? ? ? ? ? ? channel.basic_publish(exchange='',
? ? ? ? ? ? ? ? ? ? ? ? routing_key=queue_name,
? ? ? ? ? ? ? ? ? ? ? ? body=json_string,

properties=pika.BasicProperties(delivery_mode=2))
? ? ? ? ? ? ? ? ? ? channel.tx_commit()

During some robustness testing, I found that if I passed an invalid
queue
name to basic_get, I get an AMQPChannelError as expected. However, when
using the above code to write a message to an invalid queue name, no
exception is seen.

Is this normal or am I missing?something? In our scenario, we have to
absolutely, positively know that the message was received by the broker.
Yes, this is normal.

AMQP does not allow you to send message to a "queue", instead, you
send a message to an exchange with a routing key.

This routing key is a queue name in this case but it can be just anything.

Messages sent with a routing key that is not matched by appropriate
binding will be lost. This is the correct behaviour.

If you need to ensure that message is delivered use 'mandatory' flag
on basic.publish:
http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.publish

Cheers,
?Marek

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 4 of 4 | next ›
Discussion Overview
grouprabbitmq-discuss @
categoriesrabbitmq
postedMar 29, '12 at 12:16a
activeMar 30, '12 at 10:33a
posts4
users2
websiterabbitmq.com
irc#rabbitmq

2 users in discussion

Matt Pietrek: 2 posts Marek Majkowski: 2 posts

People

Translate

site design / logo © 2021 Grokbase