olaurendeau / rabbit-mq-admin-toolkit-bundle
Automate rabbitmq vhost's configuration creation / update
Installs: 93 038
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 6
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.4|^8.0
- nyholm/psr7: ^1.2
- php-http/httplug-bundle: ^1.2
- richardfullmer/rabbitmq-management-api: ^2.0
- symfony/config: ^4.4|^5.0
- symfony/console: ^4.4|^5.0
- symfony/dependency-injection: ^4.4|^5.0
- symfony/framework-bundle: ^4.4|^5.0
- symfony/http-client: ^4.4|^5.0
- symfony/http-kernel: ^4.4|^5.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-12-08 01:55:36 UTC
README
Automate rabbitmq vhost's configuration creation / update
Installation
composer require olaurendeau/rabbit-mq-admin-toolkit-bundle
Add RabbitMqAdminToolkitBundle to your bundles
// config/bundles.php <?php return [ ... Ola\RabbitMqAdminToolkitBundle\OlaRabbitMqAdminToolkitBundle::class => ['all' => true] ... ];
Update your configuration
# config/packages/ola_rabbit_mq_admin_toolkit.yaml ola_rabbit_mq_admin_toolkit: delete_allowed: true # Allow deletion of exchange, queues and binding for updating configuration. Shouldn't be enabled in production connections: default: http://user:password@localhost:15672 vhosts: default: name: /my_vhost permissions: user: ~ exchanges: exchange.a: ~ queues: queue.a: bindings: - { exchange: exchange.a, routing_key: "a.#" } - { exchange: exchange.a, routing_key: "b.#" }
Usage
Simply run app/console rabbitmq:vhost:define
.
Configuration sample
See app/console config:dump-reference OlaRabbitMqAdminToolkitBundle
for full configuration possibilities
# config/packages/ola_rabbit_mq_admin_toolkit.yaml ola_rabbit_mq_admin_toolkit: delete_allowed: true # Allow deletion of exchange, queues and binding for updating configuration. Shouldn't be enabled in production default_vhost: test # default is "default" silent_failure: true # Catch all exceptions in commands. Could be use in test environment if no rabbitmq available connections: default: http://user:password@localhost:15672 vm: http://user:password@192.168.1.1:15672 vhosts: test: name: /test connection: vm # default is "default" permissions: user: ~ exchanges: exchange.a: durable: false # default is "true" exchange.b: type: direct # default is "topic" exchange.c: ~ queues: queue.a: durable: false # default is "true" arguments: # define arguments x-message-ttl: 5000 bindings: - { exchange: exchange.a, routing_key: "a.#" } - { exchange: exchange.b, routing_key: "b.#" } queue.b: bindings: - { exchange: exchange.a, routing_key: "a.#" } - { exchange: exchange.b, routing_key: "b.#" } - { exchange: exchange.c, routing_key: "c.#" } queue.c: bindings: - { exchange: exchange.a, routing_key: "a.#" } - { exchange: exchange.c, routing_key: "c.#" }
Sharding queues
Sharding queues can be useful to process huge amount of messages.
# config/packages/ola_rabbit_mq_admin_toolkit.yaml ola_rabbit_mq_admin_toolkit: delete_allowed: true # Allow deletion of exchange, queues and binding for updating configuration. Shouldn't be enabled in production connections: default: http://user:password@localhost:15672 vhosts: default: name: /my_vhost permissions: user: ~ exchanges: exchange.a: ~ queues: queue.a.sharded: name: "queue.a.{modulus}" modulus: 5 bindings: - { exchange: exchange.a, routing_key: "a.{modulus}.#" } - { exchange: exchange.a, routing_key: "b.#" }
It will produce the following configuration :