aio-pika icon indicating copy to clipboard operation
aio-pika copied to clipboard

Don't declare declare queue/exchange to consume/publish to it

Open wyfo opened this issue 3 years ago • 0 comments

My issue is related to #281, but the associated PR (#282) doesn't completely solve it.

I would like to be able to publish to exchange without declaring it. I could use declare_exchange with passive=True (or get_exchange thanks to #282), but this imply an unnecessary round-trip by redeclaring the exchange when it already exists. Of course, I could use aiormq.Channel.basic_publish, but it would imply loosing aio_pika wrapping with logging and so on. It's also possible to instanciate directly an Exchange, but that's not very convenient.

Adding a parameter to get_exchange to prevent the declaration and just return an Exchange instance could be solution. I've made a PR #351.

wyfo avatar Oct 09 '20 15:10 wyfo