florianajir / rabbitmq-sql-bundle
RabbitMQ to sql consumer, using doctrine/dbal and php-amqplib/rabbitmq-bundle
Installs: 2 602
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.4.0
- doctrine/dbal: ^2.5
- jms/serializer: ^1.1
- jms/serializer-bundle: ^1.1
- php-amqplib/rabbitmq-bundle: ~1.6
- symfony/framework-bundle: ~2.3|~3.0
Requires (Dev)
- phploc/phploc: 2.*
- phpmd/phpmd: 2.*
- phpunit/phpunit: 4.*
- sebastian/phpcpd: 2.*
- squizlabs/php_codesniffer: 2.*
This package is auto-updated.
Last update: 2024-11-04 16:18:13 UTC
README
About
The RabbitMqSqlBundle is a symfony worker to provide rabbitmq message persistence for your application using the php-amqplib/rabbitmq-bundle and doctrine/dbal libraries.
You just need to configure the mapping in yml and execute a command, a simple and scalable rabbitmq to sql consumer to persist your entities:
php app/console rabbitmq:consumer -w sql
Features
- mapping yml config (doctrine like)
- Insert records
- Update records
- Relational records : oneToOne, oneToMany, manyToOne, manyToMany
- Update, Delete relations
- Foreign keys support
Examples
Following example shows you the consuming process to persist in database a simple subscriber from an asynchronous message data.
RabbitMQ incoming message data:
{ "name" : "Rogger Rabbit", "email" : "subscriber@acme.corp", "Groups": [ { "slug": "subscriber" } ] }
SQL requests output:
INSERT INTO `members` (`name`, `email`) VALUES ("Rogger Rabbit", "subscriber@acme.corp"); INSERT INTO `member_group` (`member_id`, `group_id`) VALUES (3, 2);
Take more inspiration from Examples documentation
License
This application is under the MIT license. See the complete license in this file :
Resources/meta/LICENSE
Installation
For Symfony Framework >= 2.3
Require the worker and its dependencies with composer:
$ composer require florianajir/rabbitmq-sql-worker
Register this bundles:
// app/AppKernel.php public function registerBundles() { $bundles = array( new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(), new FlorianAjir\RabbitMqSqlBundle\FlorianAjirRabbitMqSqlBundle(), ); }
Configuration
You have to configure the rabbitmq and the database and define message structures and database mapping.
Enjoy !