swarrot / SwarrotBundle

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

Setup exchanges/queues/bindings #73

Closed iamluc closed 7 years ago

iamluc commented 9 years ago

Hi,

Do you have any plans to support creating rabbitmq infra (exchanges/queues/bindings...) automatically ?

It would be great if we could describe it in the service configuration, then run a command to setup everything.

Thank you for this bundle !

odolbeau commented 9 years ago

Hi @iamluc! :) When I need to generate rabbitmq configuration, I use this personal project: https://github.com/odolbeau/rabbit-mq-admin-toolkit

Not sure it makes sense to have it directly in the bundle cause it's not a common need & configuring everything automatically is a bit tricky (you have to handle exchange / queue configuration, add bindings when needed, etc.).

iamluc commented 9 years ago

It seems to be what I looked for. Thanks !

But IMHO, it could be a common need. When distributing my project, I would like others developers to configure RabbitMQ as easily as the database. The only blemish I see with an external command is that it will not re-use my configuration (host, user, password,...) stored in app/config/parameters.yml. Nothing really serious.

odolbeau commented 9 years ago

In other hand, you an include this project as a dev dependencies and this way you will be able to reuse the configuration. :)

duraki commented 7 years ago

Are we not gonna speak how easy it is to configure consumer exchange options in RabbitMqBundle?

    consumers:
        my_consumer:
            connection: my_connection
            callback: prj.service_common_connection_consumer
            exchange_options: {name: 'my_gateway', type: headers}
            queue_options:    {name: 'my_queue', durable: true}
            qos_options: {prefetch_size: 0, prefetch_count: 1, global: false}

Although swarrot has a better stability concerns then for e.g. amqp-lib, I can't seems to find a reason not to implement similar sort of setup instead of using additional lib for such a task.

odolbeau commented 7 years ago

Hi!

The goal of the swarrot library is to provide an easy to use solution to consume... something! Even if swarrot is mainly use with RMQ (either through the php amqp lib or the pecl package) it can be used with any implementation (SQS, Redis, an API, ...) which don't use this exchange / binding / queue logic.

Furthermore, creating an exchange / queue / binding is not linked to the consuming part. As the only job of swarrot is to consume something, it explains why it's not implemented in the library.

I understand that it can be frustrating when moving from RabbitMqBundle. I see 2 options to avoid this drawback:

duraki commented 7 years ago

Hey, thanks for the suggestions and detailed response. That makes sense.

Are there plans in the future to make an abstraction of this and create such a system or swarrot will stay available as a consumer mainly?

odolbeau commented 7 years ago

Sorry for the delay...

Swarrot will stay as a consumer, it's not planned to create any abstraction.

stof commented 7 years ago

I don't see any way to build an abstraction over the configuration of message brokers, as each system has its own set of features. So the abstraction would not be able to configure them (or would have to find a lowest common denominator, which will probably not be enough for you). If you want to configure an AMQP system (like RabbitMQ), use the tool linked above

apoberez commented 7 years ago

Imho: Keep infrastructure logic in separate package is reasonable decision, but can you please mention this in docs.