[rabbitmq-discuss] pika's blocking channel exchange_declare hanging???

Dragos Manolescu Dragos.Manolescu at servicenow.com
Fri Jan 11 02:04:20 GMT 2013


Hi --

I am experiencing a behavior I didn't expect--and don't understand :( In the following simplified code:

        try:
            self.out_channel.exchange_declare\
                ( exchange=exchange
                , type="topic"
                , passive=False
                , durable=True
                , auto_delete=False
                , nowait=True
            )
            msg_props = pika.BasicProperties(content_type="application/json", delivery_mode=2)
            self.out_channel.basic_publish\
                ( body=message
                , exchange=exchange
                , properties=msg_props
                , routing_key=routing_key
                )
        except pika.exceptions.AMQPError:
            self.logger.exception("Message not sent")

The exchange_declare above seems to block indefinitely; out-channel is a channel obtained from a blocking connection.

Here's the context: node N1 (which contains the above code) uses pika.BlockingConnection to communicate with the broker, which is connected to two other nodes N2 and N3. Upon receiving a message from N2 via a fanout exchange, N1 acknowledges it and then sends N2 a message over a different, topic exchange. The interaction between N1 and N3 follows an identical pattern.

I noticed that when both N2 and N3 send messages to N1, the above code works as I thought it would only for one of them (say N2), while the exchange_declare hangs for the other (N3). The code works fine if I comment out the exchange_declare call. N1 uses 2 channels, one for incoming messages (fanout exchange) and one for outgoing messages (topic exchange).

I am using RabbitMQ 3.0.0 and pika 0.9.8.

Many (but not) all samples invoke exchange_declare as I did above (as it is idempotent) so I assume that I'm missing something rather than making a call I should not make. FWIW the exchange_declare for N1's other, fanout exchange never hangs.

Thanks,

-dm


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130111/8a63431c/attachment.htm>


More information about the rabbitmq-discuss mailing list