jondot / sneakers

A fast background processing framework for Ruby and RabbitMQ
https://github.com/jondot/sneakers
MIT License
2.25k stars 331 forks source link

Allow a worker to work on an existing queue without specifying an exchange #399

Open BenTalagan opened 5 years ago

BenTalagan commented 5 years ago

Sneakers currently does not allow to work on an already existing queue, without dealing with the exchange it belongs to first (thus the exchange will be either used if it does already exist or it will be created), see queue.rb.

But for authorization reasons, it could be nice to be able to create the channel, and use the queue directly if it exists. It is normally legit to have a user with minimum rights (read on an existing queue dedicated for him/here) without having to mess with the exchange (the user may have no rights at all on the exchange, only on the queue). Seems to me that sneakers does not allow to work in that specific configuration. Maybe if no exchange is passed to the worker/queue configuration, sneakers could try to skip the exchange phase and work directly with the queue ?

gabrieljoelc commented 5 years ago

Thanks for making a feature request! This is a reasonable ask. Do think you could throw together a PR?

BenTalagan commented 5 years ago

Sure! Really minimalist, though, but hope it helps: #401.