easybib / rabbitmq-service-provider
Silex Service Provider for RabbitMQ with Symfony Event forwarding
1.0.2
2015-04-20 17:27 UTC
Requires
- php: >=5.4.0
- fiunchinho/rabbitmq-service-provider: ~1.0.1
- knplabs/console-service-provider: ~1.0.0
- oldsound/rabbitmq-bundle: ~1.5.0 || ~1.6.0@dev
- silex/silex: ~1.2
Requires (Dev)
- phpunit/phpunit: ~4.6.0
Suggests
- guzzle/guzzle: To access administrative commands using the management API
Conflicts
- oldsound/rabbitmq-bundle: <=1.5.0 || >=1.6.0-dev,<=1.6.0
This package is not auto-updated.
Last update: 2024-11-13 19:35:30 UTC
README
About
This service provider expands fiunchinho/rabbitmq-service-provider with further functionality:
- forwarding of serializable events to RabbitMQ
- command to run fabric setup based on RabbitMqBundle
Usage
In addition to the standard configuration you can specify a list of Symfony
Event names in rabbit.forward.events
which will be published on the producer
with the name in rabbit.forward.producer
. These events must inherit from
EasyBib\Silex\RabbitMq\SerializableEvent
.
Example configuration
$app->register(new RabbitMqServiceProvider(), [ 'rabbit.connections' => [ 'default' => [ 'host' => 'localhost', 'port' => 5672, 'user' => 'guest', 'password' => 'guest', 'vhost' => '/' ], 'another' => [ 'host' => 'another_host', 'port' => 5672, 'user' => 'guest', 'password' => 'guest', 'vhost' => '/' ] ], 'rabbit.producers' => [ 'first_producer' => [ 'connection' => 'another', 'exchange_options' => ['name' => 'a_exchange', 'type' => 'topic'] ], 'second_producer' => [ 'connection' => 'default', 'exchange_options' => ['name' => 'a_exchange', 'type' => 'topic'] ], ], 'rabbit.consumers' => [ 'a_consumer' => [ 'connection' => 'default', 'exchange_options' => ['name' => 'a_exchange','type' => 'topic'], 'queue_options' => ['name' => 'a_queue', 'routing_keys' => ['foo.#']], 'callback' => 'your_consumer_service' ] ], 'rabbit.forward.events' => [ 'foo.my.event', 'foo.some.event', 'bar.the.other', ], 'rabbit.forward.producer' => 'first_producer', ]);