Hi,

I'm using Pika 0.9.5 with python 2.7 successfully, but I'm running into
some issues when it comes to handle errors from the RabbitMQ broker.
I would like to deal programmatically with errors of this kind :

=ERROR REPORT==== 7-Feb-2012::14:13:40 ===
connection <0.25027.3>, channel 1 - error:
{amqp_error,precondition_failed,
"cannot redeclare exchange 'status' in vhost '/' with different
type, durable, internal or autodelete value",
'exchange.declare'}

This log is from the rabbitmq log.

I'm using the Pika SelectConnection, and my app is hanging somewhere after
calling channel.exchange_declare and never gets into my callback.

def on_channel_open(channel):
channel.exchange_declare(
exchange="status",
callback=on_exchange_declared)

What would be the way, in this case (and more generally) to "catch" errors
like this one in my code ?


Rapha?l
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120207/94434234/attachment.htm>

Search Discussions

  • Jerry Kuch at Feb 7, 2012 at 4:34 pm
    Hi, Raphael:

    This is actually a behavior defined in the AMQP specification.
    AMQP allows applications quite a free hand (within the bounds
    of permissions) to declare elements of their messaging fabric
    such as queues, exchanges and the bindings between them.

    A common idiom in AMQP programs is to defensively declare a
    resource you're about to use prior to its use. If the resource
    already exists, and its properties entirely agree with what
    you're asking for, the operation succeeds idempotently and life
    goes on. If, however, there was already an entity with the
    given name, but different properties, it's not safe to toss the
    old one and create you a new one (who else might be using it?)
    so you end up with 404/not-found.

    If you really want a new entity with new properties, you'll have
    to delete the old one and create anew...

    Best regards,
    Jerry

    ----- Original Message -----
    From: "Rapha?l De GIUSTI" <raphael.degiusti at guardis.com>
    To: rabbitmq-discuss at lists.rabbitmq.com
    Sent: Tuesday, February 7, 2012 5:42:37 AM
    Subject: [rabbitmq-discuss] Pika - Catch amqp error - Cannot redeclare exchange with different type


    Hi,


    I'm using Pika 0.9.5 with python 2.7 successfully, but I'm running into some issues when it comes to handle errors from the RabbitMQ broker.
    I would like to deal programmatically with errors of this kind :



    =ERROR REPORT==== 7-Feb-2012::14:13:40 ===
    connection <0.25027.3>, channel 1 - error:
    {amqp_error,precondition_failed,
    "cannot redeclare exchange 'status' in vhost '/' with different type, durable, internal or autodelete value",
    'exchange.declare'}


    This log is from the rabbitmq log.


    I'm using the Pika SelectConnection, and my app is hanging somewhere after calling channel.exchange_declare and never gets into my callback.



    def on_channel_open(channel):
    channel.exchange_declare(
    exchange="status",
    callback=on_exchange_declared)


    What would be the way, in this case (and more generally) to "catch" errors like this one in my code ?




    Rapha?l
    _______________________________________________
    rabbitmq-discuss mailing list
    rabbitmq-discuss at lists.rabbitmq.com
    https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprabbitmq-discuss @
categoriesrabbitmq
postedFeb 7, '12 at 1:42p
activeFeb 7, '12 at 4:34p
posts2
users2
websiterabbitmq.com
irc#rabbitmq

2 users in discussion

Jerry Kuch: 1 post Raphaël De GIUSTI: 1 post

People

Translate

site design / logo © 2022 Grokbase