https://github.com/florianajir/rabbitmq-sql-worker
:incoming_envelope: :floppy_disk: RabbitMQ php symfony worker providing SQL persistence with relationship support
https://github.com/florianajir/rabbitmq-sql-worker
php rabbitmq sql symfony
Last synced: 4 months ago
JSON representation
:incoming_envelope: :floppy_disk: RabbitMQ php symfony worker providing SQL persistence with relationship support
- Host: GitHub
- URL: https://github.com/florianajir/rabbitmq-sql-worker
- Owner: florianajir
- Created: 2015-06-12T14:18:19.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2023-05-04T12:57:15.000Z (almost 3 years ago)
- Last Synced: 2025-05-29T18:17:22.043Z (10 months ago)
- Topics: php, rabbitmq, sql, symfony
- Language: PHP
- Homepage: https://packagist.org/packages/florianajir/rabbitmq-sql-bundle
- Size: 563 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rabbitmq-sql-worker
[](https://packagist.org/packages/florianajir/rabbitmq-sql-bundle) [](https://packagist.org/packages/florianajir/rabbitmq-sql-bundle) [](https://packagist.org/packages/florianajir/rabbitmq-sql-bundle) [](https://packagist.org/packages/florianajir/rabbitmq-sql-bundle) [](https://packagist.org/packages/florianajir/rabbitmq-sql-bundle)
[](https://scrutinizer-ci.com/g/florianajir/rabbitmq-sql-worker/?branch=master) [](https://scrutinizer-ci.com/g/florianajir/rabbitmq-sql-worker/?branch=master)
## 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:
```shellScript
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:
```json
{
"name" : "Rogger Rabbit",
"email" : "subscriber@acme.corp",
"Groups": [ { "slug": "subscriber" } ]
}
```
SQL requests output:
```sql
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](Resources/doc/examples.md)
## 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:
```bash
$ composer require florianajir/rabbitmq-sql-worker
```
Register this bundles:
```php
// 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.
* [Rabbitmq-sql Configuration](Resources/doc/configuration.md)
* [Mapping Documentation](Resources/doc/configuration.md)
Enjoy !