Polyconseil / aioamqp

AMQP implementation using asyncio
Other
280 stars 88 forks source link

Unable to subscribe to a queue with wildcard (asterisk) #235

Closed kamichal closed 2 years ago

kamichal commented 2 years ago

With new release of aioamqp==0.15.0 a new version of pamqp is used 3.1.0 and it causes problems with subscription to a queue with a wildcard (using asterisk in the name).

  File "/usr/local/lib/python3.9/site-packages/aioamqp/channel.py", line 299, in queue_declare
    request = pamqp.commands.Queue.Declare(
  File "/usr/local/lib/python3.9/site-packages/pamqp/commands.py", line 1260, in __init__
    self.validate()
  File "/usr/local/lib/python3.9/site-packages/pamqp/commands.py", line 1275, in validate
    raise ValueError('Invalid value for queue')
ValueError: Invalid value for queue

That's happening while subscribing: channel.queue_declare(queue_name="that.queue.name.*")

A simple fix for this is to replace "*" to "all" and "#" to "any" in the queue name.

RemiCardona commented 2 years ago

Looking at the specs [1] it looks like pamqp is right, though rabbitmq itself doesn't care what the queues are called and allows all names.

I don't see anywhere that * and # hold any special meaning within rabbitmq. Could you elaborate on why/how you are using those names?

As far as I can see, there's no bug here, just an inconvenience because the spec is now enforced.

Cheers

https://www.rabbitmq.com/specification.html

kamichal commented 2 years ago

Oh, yes, my misinterpretation. Those characters have special meaning, but in topic names, when using "topic exchange", not in queue names.

https://www.rabbitmq.com/tutorials/tutorial-five-python.html However, previously queue name could contain those, while since 0.15.0 - cannot.

RemiCardona commented 2 years ago

That's what I thought too, thanks for clearing it up. Cheers.