swarrot / SwarrotBundle

A symfony bundle for swarrot integration
MIT License
89 stars 59 forks source link

Why the message type is not used as the queue name by default #154

Closed lyrixx closed 5 years ago

lyrixx commented 5 years ago

I know this is not necessary true, but it could be so useful.

Given this configuration:

swarrot:
    messages_types:
        crawler.update_db:
            exchange: 'redirectionio'
            routing_key: 'crawler.update_db'

Instead of

bin/console bin/console  swarrot:consume:crawler_update_db crawler.update_db

I would like to run

bin/console bin/console  swarrot:consume:crawler_update_db
odolbeau commented 5 years ago

Message types & consumers are totally de-correlated in swarrot. We don't know which queue you want to consume in any way and we can't guess it from our message types. In your case, the queue will be crawler.update_db if you use the direct exchange but that's not mandatory. Furthermore, you could have more that 1 message_types for a given consumer, in this case it's just impossible to guess which queue you're looking to consume.

What could be done is adding a new default_queue property in consumers config & use it in the generated command.

odolbeau commented 5 years ago

Guess what, it already exists! https://github.com/swarrot/SwarrotBundle/blob/master/DependencyInjection/Configuration.php#L160

lyrixx commented 5 years ago

Ah nice :) thanks