Freezing method calls for creating queues, exchanges and bindings
See original GitHub issueIn both Pika 0.13.0 and 1.0.0b1, some method calls for creating queues, exchanges and bindings are freezing (blocking forever instead of returning or raising an exception) with some arguments. These unexpected behaviours are emphasized in bold below.
queue_declare
queue_declare()
OK, raises TypeError: queue_declare() missing 1 required positional argument: ‘queue’ in Pika 1.0.0b1, creates a queue with a unique name in Pika 0.13.0.queue_declare(queue=None)
Unexpected, freezes instead of creating a queue with a unique name.queue_declare(queue="")
OK, creates a queue with a unique name.
exchange_declare
exchange_declare()
Unexpected, freezes instead of raising TypeError: exchange_declare() missing 1 required positional argument: ‘queue’.exchange_declare(exchange=None)
Unexpected, freezes instead of raising pika.exceptions.ChannelClosed: (403, ‘ACCESS_REFUSED - operation not permitted on the default exchange’).exchange_declare(exchange="")
OK, raises pika.exceptions.ChannelClosed: (403, ‘ACCESS_REFUSED - operation not permitted on the default exchange’).
queue_bind
queue_bind()
OK, raises TypeError: queue_bind() missing 2 required positional arguments: ‘queue’ and ‘exchange’;queue_bind(queue=None, exchange=None, routing_key=None)
Unexpected, freezes instead of raising pika.exceptions.ChannelClosed: (403, ‘ACCESS_REFUSED - operation not permitted on the default exchange’).queue_bind(queue="", exchange="", routing_key="")
OK, raises pika.exceptions.ChannelClosed: (403, ‘ACCESS_REFUSED - operation not permitted on the default exchange’).
exchange_bind
exchange_bind()
Unexpected, freezes instead of raising TypeError: exchange_declare() missing 2 required positional arguments: ‘destination’ and ‘source’.exchange_bind(destination=None, source=None, routing_key=None)
Unexpected, freezes instead of raising pika.exceptions.ChannelClosed: (403, ‘ACCESS_REFUSED - operation not permitted on the default exchange’).exchange_bind(destination="", source="", routing_key="")
OK, raises pika.exceptions.ChannelClosed: (403, ‘ACCESS_REFUSED - operation not permitted on the default exchange’).
I used a BlockingChannel
for all the method calls. For instance:
import pika
parameters = pika.ConnectionParameters()
with pika.BlockingConnection(parameters) as connection:
channel = connection.channel()
channel.queue_declare(queue=None)
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Part 4: RabbitMQ Exchanges, routing keys and bindings
The consumer creates a queue and sets up a binding with a given routing pattern to the exchange. All messages with a routing...
Read more >Does RabbitMQ create queue/exchange if already exist?
The RabbitMQ server does not by itself create exchanges or queues. You must use the web admin GUI, a command line tool, or...
Read more >AMQP 0-9-1 Model Explained - RabbitMQ
Exchanges take a message and route it into zero or more queues. The routing algorithm used depends on the exchange type and rules...
Read more >Kombu Documentation - Read the Docs
Binding exchanges and queues to a connection will make it use ... callback function is called by kombu every time a new message...
Read more >Repair failed installations of Exchange Cumulative and ...
This article describes the methods to verify the installation of Microsoft Exchange Server Cumulative Updates (CUs) and Security Updates ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@maggyero I will make those changes, thanks.
@lukebakken Okay thanks. So if I understood well you added validation for addressing the case:
exchange_bind(destination=None, source=None, routing_key=None)
That way instead of freezing the function
validators.require_string
will raise:which addresses one of the six unexpected behaviours that I listed. (And in Pika 1.0.0b2 the function
validators.require_string
will raise aValueError
instead of the currentTypeError
.)I see also that on 22 January 2019 you addressed three other cases by adding the same validation:
queue_declare(queue=None)
queue_bind(queue=None, exchange=None, routing_key=None)
exchange_declare(exchange=None)
So there remains two cases to address:
exchange_declare()
exchange_bind()
They can be addressed by simply removing the default
None
arguments in the definitions:and
That way they the call
exchange_declare()
would raiseand the call
exchange_bind()
would raise:which is consistent with the symmetric calls
queue_declare()
andqueue_bind()
which already raise theseTypeError
.